Example #1
0
void calglSubDisplayWindow3D(void){
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	currentModel3D = glutGetWindow()-2;

	glPushMatrix();	{
		glTranslatef(xPos[currentModel3D], yPos[currentModel3D], zPos[currentModel3D]);

		glRotatef((GLfloat) xRot[currentModel3D], 1.0f, 0.0f, 0.0f);
		glRotatef((GLfloat) yRot[currentModel3D], 0.0f, 1.0f, 0.0f);	
		glRotatef((GLfloat) zRot[currentModel3D], 0.0f, 0.0f, 1.0f);

		if(window3D->models[currentModel3D]->modelLight){
			glEnable(GL_LIGHTING);
			glEnable(window3D->models[currentModel3D]->modelLight->currentLight);
			glEnable(GL_COLOR_MATERIAL);
			glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
			glEnable(GL_NORMALIZE);
		}

		calglDisplayModel3D(window3D->models[currentModel3D]);

		if(window3D->models[currentModel3D]->infoBar){
			calglDisplayBar3D(window3D->models[currentModel3D]->infoBar);
		}

		currentModel3D = (currentModel3D+1)%window3D->noModels;
	}	glPopMatrix();

	glutSwapBuffers();
}
Example #2
0
void calglSubDisplayWindow3D(void){
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	currentModel3D = glutGetWindow() - 2;

	if(window3D->models[currentModel3D]->modelLight)
		calglApplyLightParameter(window3D->models[currentModel3D]->modelLight);

	glPushMatrix();	{
		glTranslatef(xPos[currentModel3D], yPos[currentModel3D], zPos[currentModel3D]);

		glRotatef((GLfloat)xRot[currentModel3D], 1.0f, 0.0f, 0.0f);
		glRotatef((GLfloat)yRot[currentModel3D], 0.0f, 1.0f, 0.0f);
		glRotatef((GLfloat)zRot[currentModel3D], 0.0f, 0.0f, 1.0f);

		if (window3D->models[currentModel3D]->modelLight){
			glEnable(GL_LIGHTING);
			glEnable(window3D->models[currentModel3D]->modelLight->currentLight);
			glEnable(GL_COLOR_MATERIAL);
			glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
			glEnable(GL_NORMALIZE);

			// Light Cone Drawing - Enable this for debugging
			//glPushMatrix ();	{
			//	glTranslatef (window3D->models[currentModel3D]->modelLight->lightPosition[0],
			//		window3D->models[currentModel3D]->modelLight->lightPosition[1],
			//		window3D->models[currentModel3D]->modelLight->lightPosition[2]);
			//	//glRotatef (-90, 1.0f, 0.0f, 0.0f);
			//	//glColor3f (1.0f, 0.0f, 0.0f);
			//	//glutSolidCone (0.5, 1.5, 10, 12);
			//	glColor3f (1.0f, 1.0f, 0.0f);
			//	glutSolidSphere (0.4, 10, 12);
			//}	glPopMatrix ();
		}

		calglDisplayModel3D(window3D->models[currentModel3D]);

		if (window3D->models[currentModel3D]->infoBar){
			calglDisplayBar3D(window3D->models[currentModel3D]->infoBar);
		}

		currentModel3D = (currentModel3D + 1) % window3D->noModels;
	}	glPopMatrix();

	glutSwapBuffers();
}