コード例 #1
0
ファイル: igm.c プロジェクト: magicseb/ced2911repo
void updateIGM(int debut, int fin)
{
	if(debut)
		Xe_InvalidateState(xe);

	//Dessine la scene
	XeDrawSurface2(igmBg, -1, -1, 2, 2, 1);
	//XeDrawSurface(igmBarr,-1,-1,1,1,1);//Barr en haut
	XeDrawSurface2(igmBarr, -1, 0.7, 2, .3, 1);
	//event sur la manette
	igmInput();
	switch(menuselected)
	{
		case 0:
			drawMenuIcon();
			break;

		case ITEM_RETURN_TO_MENU:
			drawReturnToMenu();
			break;
		case ITEM_DISPLAY_INFO:
			drawInformation();
			break;
		default:
			drawMenuIcon();
			break;

	}

	if(fin)
	{
		Xe_SetClearColor(xe, ~0);

		/* resolve (and clear) */
		Xe_Resolve(xe);

		/* wait for render finish */
		while (!Xe_IsVBlank(xe));
		Xe_Sync(xe);


	}
	nframe=1.0f;
}
コード例 #2
0
void PerspectiveGLWidget::paintGL()
{
	sceneTransformations();
	LightManager::getInstance ()->enableLighting ();
	LightManager::getInstance ()->doLight ();
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	if(isGridDrawingEnabled)
		drawGrid();
	glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
	ModelManager::getInstance ()->draw ();

	glDisable (GL_LIGHTING);
	GLUquadricObj *sphere=NULL;
	glLineWidth (3);
	glPushMatrix ();
	glTranslatef (10, 10, 10);
	glColor3f (1.0, 1.0, 1.0);
	sphere = gluNewQuadric();
	gluSphere(sphere, 0.15, 20, 20);
	glBegin (GL_LINES);
	glVertex3f (0, 0.3, 0);
	glVertex3f (0, -0.3, 0);
	glVertex3f (0.3, 0, 0);
	glVertex3f (-0.3, 0, 0);
	glVertex3f (0, 0, 0.3);
	glVertex3f (0, 0, -0.3);
	glVertex3f (0.1, 0.1, 0.1);
	glVertex3f (-0.1, -0.1, -0.1);
	glVertex3f (0.1, 0.1, -0.1);
	glVertex3f (-0.1, -0.1, 0.1);
	glVertex3f (-0.1, 0.1, -0.1);
	glVertex3f (0.1, -0.1, 0.1);
	glVertex3f (-0.1, 0.1, 0.1);
	glVertex3f (0.1, -0.1, -0.1);
	glEnd ();
	glEnable (GL_LIGHTING);
	glLineWidth (1);
	glPopMatrix ();
	if(selectionRectangle)
	{
		glDisable (GL_LIGHTING);
		glClear(GL_DEPTH_BUFFER_BIT);//This must be exist.For drawing in same z depth.
		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
		float finishDrawingPositionX = mapFromGlobal (QCursor::pos ()).x ();
		float finishDrawingPositionZ = mapFromGlobal (QCursor::pos ()).y ();
		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		glOrtho(0.0, glWidgetWidth, glWidgetHeight, 0.0, 1.0, -1.0);
		glMatrixMode(GL_MODELVIEW);
		glLoadIdentity();
		gluLookAt (0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
		glColor3f(1.0, 1.0, 1.0);
		glLineStipple(1, 0xF0F0);
		glBegin(GL_LINE_LOOP);
		glVertex2f(curXSelectionRectangle, curYSelectionRectangle);
		glVertex2f(finishDrawingPositionX, curYSelectionRectangle);
		glVertex2f(finishDrawingPositionX, finishDrawingPositionZ);
		glVertex2f(curXSelectionRectangle, finishDrawingPositionZ);
		glEnd();
		glLineStipple(1, 0xFFFF);
		glColor4f(0.5, 0.5, 0.0, 0.5);
		glBegin(GL_QUADS);
		glVertex2f(curXSelectionRectangle, curYSelectionRectangle);
		glVertex2f(finishDrawingPositionX, curYSelectionRectangle);
		glVertex2f(finishDrawingPositionX, finishDrawingPositionZ);
		glVertex2f(curXSelectionRectangle, finishDrawingPositionZ);
		glEnd();
		glDisable (GL_LIGHTING);
	}
	drawInformation();
}