Пример #1
0
void WPopupMenu::popupImpl()
{
  renderOutAll();

  result_ = 0;

  WApplication *app = WApplication::instance();

  // XXX
  // We rely here on the fact that no other widget is listening for
  // escape on the root()
  if (app->globalEscapePressed().isConnected())
    app->globalEscapePressed().emit();

  globalClickConnection_
    = app->root()->clicked().connect(this, &WPopupMenu::done);
  globalEscapeConnection_
    = app->globalEscapePressed().connect(this, &WPopupMenu::done);

  app->pushExposedConstraint(this);

  prepareRender(app);

  show();
}
Пример #2
0
void SGNode::render(const G3MRenderContext* rc,
                    const GLState& parentState,
                    bool renderNotReadyShapes) {
  const GLState* myState = createState(rc, parentState);
  const GLState* state;
  if (myState == NULL) {
    state = &parentState;
  }
  else {
    state = myState;
  }

  prepareRender(rc);

  rawRender(rc, *state);

  const int childrenCount = _children.size();
  for (int i = 0; i < childrenCount; i++) {
    SGNode* child = _children[i];
    child->render(rc, *state, renderNotReadyShapes);
  }

  cleanUpRender(rc);
  
  delete myState;
}
Пример #3
0
void WPopupMenu::popupImpl()
{
  result_ = 0;

  WApplication *app = WApplication::instance();
  prepareRender(app);

  show();
}
Пример #4
0
WidgetAreaPreview::WidgetAreaPreview(WidgetArea *area, QWidget *parent) : QWidget(parent)
{
    m_widgetArea = area;
    m_smooth = sConfig.get(CFG_BOOL_SMOOTH_SCALING);

    move(area->pos());
    resize(area->width()/3, area->height()/3);
    prepareRender();
    show();
}
Пример #5
0
void GLSprite::render()
{
    if(prepareRender())
    {
        GLDriver::renderTexture2DTriangleStrip(_texture->textureData()->identifier, _vertices, _textureCoordinates, _pointsNumber, _coordinatesNumber);
        GLDriver::popMatrix();
        GLDriver::color4f(FULL_COLOR, FULL_COLOR, FULL_COLOR, FULL_COLOR);
    }
    
    GLRenderable::render();
}
void BakedOpRenderer::renderFunctor(const FunctorOp& op, const BakedOpState& state) {
    prepareRender(&state.computedState.clippedBounds, state.computedState.getClipIfNeeded());

    DrawGlInfo info;
    auto&& clip = state.computedState.clipRect();
    info.clipLeft = clip.left;
    info.clipTop = clip.top;
    info.clipRight = clip.right;
    info.clipBottom = clip.bottom;
    info.isLayer = offscreenRenderTarget();
    info.width = mRenderTarget.viewportWidth;
    info.height = mRenderTarget.viewportHeight;
    state.computedState.transform.copyTo(&info.transform[0]);

    mRenderState.invokeFunctor(op.functor, DrawGlInfo::kModeDraw, &info);
}
// this function run the boilerplate to setup the openmax components;
int
setupOpenMaxJpegDecoder(OPENMAX_JPEG_DECODER ** pDecoder)
{
    *pDecoder = malloc(sizeof(OPENMAX_JPEG_DECODER));
    if (pDecoder[0] == NULL) {
	perror("malloc decoder");
	return OMXJPEG_ERROR_MEMORY;
    }
    memset(*pDecoder, 0, sizeof(OPENMAX_JPEG_DECODER));

    if ((pDecoder[0]->client = ilclient_init()) == NULL) {
	perror("ilclient_init");
	return OMXJPEG_ERROR_ILCLIENT_INIT;
    }

    if (OMX_Init() != OMX_ErrorNone) {
	ilclient_destroy(pDecoder[0]->client);
	perror("OMX_Init");
	return OMXJPEG_ERROR_OMX_INIT;
    }
    // prepare the image decoder
    int             ret = prepareImageDecoder(pDecoder[0]);
    if (ret != OMXJPEG_OK)
	return ret;

    ret = prepareRender(pDecoder[0]);
    if (ret != OMXJPEG_OK)
	return ret;

    ret = startupImageDecoder(pDecoder[0]);
    if (ret != OMXJPEG_OK)
	return ret;

    ret = startupImageRender(pDecoder[0]);
    if (ret != OMXJPEG_OK)
	return ret;

    return OMXJPEG_OK;
}
Пример #8
0
// Render a previously prepared sentence at (x,y) window coords
// (0,0) is the top left corner of the window
void
VSFontLib::renderSentence(int x, int y, unsigned int index)
{
	if (mSentences[index].getVAO()) {

		prepareRender((float)x,(float)y);

		// set the material
		setMaterial(mMaterial);

		glActiveTexture(GL_TEXTURE0);
		glBindTexture(GL_TEXTURE_2D, mFontTex);

		mVSML->matricesToGL();		
		glBindVertexArray(mSentences[index].getVAO());
		glDrawArrays(GL_TRIANGLES, 0, mSentences[index].getSize()*6);
		glBindVertexArray(0);

		glBindTexture(GL_TEXTURE_2D,0);

		restoreRender();
	}
}
Пример #9
0
void Camera::render() 
{
	synchronized( s_globalMutex );

	// - prepare scene rendering
	// - render objects in n passes
	// - update statistics
	// - reset temporaries

	gd::GraphicsDevice* dev = Context::device();
	int renderedPrimitives	= dev->renderedPrimitives();
	int renderedTriangles	= dev->renderedTriangles();
	int materialChanges		= dev->materialChanges();

	// - DEBUG: warn if we have non-square pixels
	Matrix4x4 proj = projectionTransform();
	Vector4 cp( 1,1,10,1 );
	Vector4 pp = (proj * cp);
	pp *= 1.f / pp.w;
	pp.x = pp.x * (viewportWidth()*.5f);
	pp.y = pp.y * (viewportHeight()*.5f);
	if ( Math::abs(pp.x-pp.y) > 1.f )
		Debug::println( "Non-square pixels! (fov={0}, w={1}, h={2})", Math::toDegrees(horizontalFov()), viewportWidth(), viewportHeight() );

	prepareRender();

	// - render objects in n passes

	// pass 1<<0: solid objects which are affected by shadows
	// pass 1<<1: (unused)
	// pass 1<<2: shadow volumes
	// pass 1<<3: shadow filler polygon
	// pass 1<<4: solid objects which are not affected by shadows
	// pass 1<<5: transparent objects which are not affected by shadows
	
	// the first pass is front to back...
	//Debug::println( "{0}({1})", __FILE__, __LINE__ );
	{//dev::Profile pr( "Camera.render( pass 1 )" );
	int i;
	for ( i = 0 ; i < (int)s_objs.size() ; ++i )
	{
		Node* obj = s_objs[i];
		//Debug::println( "rendering {0}({1})", obj->name(), i );
		obj->render( this, 1 );
	}
	}

	// ...and the rest back to front
	//Debug::println( "{0}({1})", __FILE__, __LINE__ );
	{//dev::Profile pr( "Camera.render( other passes )" );
	for ( int pass = 2 ; pass <= LAST_RENDERING_PASS ; pass <<= 1 )
	{
		for ( int i = (int)s_objs.size() ; i-- > 0 ; )
		{
			Node* obj = s_objs[i];
			obj->render( this, pass );
		}
	}
	}

	// - update statistics
	m_renderedPrimitives	+= dev->renderedPrimitives() - renderedPrimitives;
	m_renderedTriangles		+= dev->renderedTriangles()	- renderedTriangles;
	m_materialChanges		+= dev->materialChanges()	- materialChanges;

	// - reset temporaries
	m_worldToCamera = Matrix4x4(0);
	dev->setViewport( 0, 0, dev->width(), dev->height() );
	//Debug::println( "{0}({1})", __FILE__, __LINE__ );
}
Пример #10
0
void MenuOptions::run() {
	buttons.push_back(Button(-0.8, -0.9, 1.6, 0.15, "OK"));
	const float textSizeFactor = 0.5;
	int i = 0;
	buttons.push_back(Button(-0.4, 0.4-0.2*i, 0.3, 0.10, "Fullscreen", textSizeFactor));
	buttons.push_back(Button(-0.0, 0.4-0.2*i, 0.3, 0.10, "Window", textSizeFactor));

	i=1;
	buttons.push_back(Button(-0.4, 0.4-0.2*i, 0.3, 0.10, "60 (low)", textSizeFactor));
	buttons.push_back(Button(-0.0, 0.4-0.2*i, 0.3, 0.10, "120 (normal)", textSizeFactor));
	buttons.push_back(Button(+0.4, 0.4-0.2*i, 0.3, 0.10, "MAX", textSizeFactor));

	i=2;
	buttons.push_back(Button(-0.4, 0.4-0.2*i, 0.3, 0.10, "Yes", textSizeFactor));
	buttons.push_back(Button(-0.0, 0.4-0.2*i, 0.3, 0.10, "No", textSizeFactor));

	i=3;
	buttons.push_back(Button(-0.4, 0.4-0.2*i, 0.3, 0.10, "Yes", textSizeFactor));
	buttons.push_back(Button(-0.0, 0.4-0.2*i, 0.3, 0.10, "No", textSizeFactor));

	//i=4;
	//buttons.push_back(Button(-0.4, 0.4-0.2*i, 0.3, 0.10, "Yes", textSizeFactor));
	//buttons.push_back(Button(-0.0, 0.4-0.2*i, 0.3, 0.10, "No", textSizeFactor));

	int pressedButton = -1;

	// place cursor at correct position
	cursor.setFromMouse();

	// Prepare rendering
	prepareRender();

	while (true) {
		if (initVideoCounter != Program::getInstance()->initVideoCounter) {
			// Video was reinitialized, so we need to resend display lists
			prepareRender();
		}

		// Rendering
		glClear(GL_COLOR_BUFFER_BIT);

		// Render fixed parts of the maze
		glCallList(fixedObjectsDisplayList);

		// show FPS counter
		Program::getInstance()->fps->renderInMenu();

		// which buttons are selected
		buttons[1].select(Program::getInstance()->fullscreen);
		buttons[2].select(!Program::getInstance()->fullscreen);
		buttons[3].select(Program::getInstance()->config.fpsBehaviour == -1);
		buttons[4].select(Program::getInstance()->config.fpsBehaviour == 0);
		buttons[5].select(Program::getInstance()->config.fpsBehaviour == 1);
		buttons[6].select(Program::getInstance()->config.showFPS);
		buttons[7].select(!Program::getInstance()->config.showFPS);
		buttons[8].select(Program::getInstance()->config.music);
		buttons[9].select(!Program::getInstance()->config.music);
		//buttons[10].select(Program::getInstance()->config.sound);
		//buttons[11].select(!Program::getInstance()->config.sound);

		// render buttons
		for (int b=0; b<(int) buttons.size(); b++) {
			glLoadIdentity();
			if (pressedButton == b) {
				buttons[b].render(2);
			} else {
				buttons[b].render(buttons[b].over(cursor.x, cursor.y));
			}
		}

		// render cursor
		cursor.render();

		SDL_GL_SwapBuffers();


		// Event handling
		SDL_Event event;
		while (SDL_PollEvent(&event)) {
			Program::getInstance()->generalEventHandler(&event);
			switch (event.type) {
				case SDL_MOUSEMOTION:
					cursor.setFromWindowXY(event.motion.x, event.motion.y);
					break;
				case SDL_MOUSEBUTTONDOWN:
					if (event.button.button == SDL_BUTTON_LEFT || event.button.button == SDL_BUTTON_RIGHT) {
						for (int b=0; b<(int) buttons.size(); b++) {
							if (buttons[b].over(cursor.x, cursor.y)) {
								pressedButton = b;
							}
						}
					}
					break;
				case SDL_MOUSEBUTTONUP:
					if (event.button.button == SDL_BUTTON_LEFT || event.button.button == SDL_BUTTON_RIGHT) {
						if (pressedButton >= 0) {
							if (buttons[pressedButton].over(cursor.x, cursor.y)) {
								if (pressedButton == 0) {
									Program::getInstance()->scene = 0;
									return;
								} else {
									selectOption(pressedButton);
								}
							}
							pressedButton = -1;
						}
					}
					break;
				case SDL_KEYUP:
					if (event.key.keysym.sym == SDLK_ESCAPE) {
						Program::getInstance()->scene = 0;
						return;
					}
					break;
			}

		}

		// Count FPS and wait some time before rendering next frame
		Program::getInstance()->fps->waitInMenu();

	}
}
Пример #11
0
void Renderer::render() {
	//glViewport(0,0,glWidth,glHeight);

	prepareRender();
	IShadow::clearShadow();

	static float cam[9];

	if (rData->fpsEnabled) {
		float r;

		cam[0] = rData->FPScoords.pos[0];
		cam[1] = rData->FPScoords.pos[1];
		cam[2] = rData->FPScoords.pos[2];

		cam[4] = FPS_CONST * std::sin(rData->FPScoords.rot[1]);
		r = FPS_CONST * std::cos(rData->FPScoords.rot[1]);

		cam[3] = r * std::sin(rData->FPScoords.rot[0]);
		cam[5] = r * std::cos(rData->FPScoords.rot[0]);

		cam[3] += cam[0];
		cam[4] += cam[1];
		cam[5] += cam[2];
		cam[6] = 0.0;
		cam[7] = 1.0;
		cam[8] = 0.0;
	} else {
		cam[0] = rData->camPos.pos[0];
		cam[1] = rData->camPos.pos[1];
		cam[2] = rData->camPos.pos[2];
		cam[3] = rData->camPos.targ[0];
		cam[4] = rData->camPos.targ[1];
		cam[5] = rData->camPos.targ[2];
		cam[6] = rData->camPos.up[0];
		cam[7] = rData->camPos.up[1];
		cam[8] = rData->camPos.up[2];
	}

	gluLookAt(cam[0], cam[1], cam[2], cam[3], cam[4], cam[5], cam[6], cam[7],
			cam[8]);

	sky->render(cam);
	glColor4f(1.0,1.0,1.0,1.0);
	LightInfoStruct lis;
	sky->getLightInfo(lis);
	rData->fenyek[0]->setAll(lis);

	for (unsigned i = 0; i < rData->fenyek.size(); i++) {
		rData->fenyek[i]->Render();
	}
	//glTranslatef(0, 0, -30);
	//glPushMatrix();
	//glColor3f(0.75, 0.75, 0.75);
	//glRotatef(rData->triangleRot, 0.0, 1.0, 0.0);

	std::map<std::string, Part*>::iterator mod;
	for (mod = rData->modellek.begin(); mod != rData->modellek.end(); mod++) {
		if (mod->second->getMapped())
			cubeMapper->Render(mod->second, rData->fenyek[0]->getVector(), 0.0);
		else
			mod->second->render(rData->fenyek[0]->getVector(), 0.0);
	}

	//glPopMatrix();

	GlutImp::getInstance()->swapBuffers();
}
void BakedOpRenderer::renderGlopImpl(const Rect* dirtyBounds, const ClipBase* clip,
        const Glop& glop) {
    prepareRender(dirtyBounds, clip);
    mRenderState.render(glop, mRenderTarget.orthoMatrix);
    if (!mRenderTarget.frameBufferId) mHasDrawn = true;
}