Archived

This topic is now archived and is closed to further replies.

HardSniper

Question about DrawGLScene()

Recommended Posts

I can''t figure out exactly how this function works when the program is executed... I understand how it draws things to the screen, but I can''t figure out what makes it continually move them around if you have a variable that is incremented for something like rotation. I can''t find anything in the code that says to keep redrawing the scene with the function until the user presses escape. So it seems like the code would run once, then stop, but it can''t if it rotates something...
  
int DrawGLScene(GLvoid)						
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glLoadIdentity();					

	glTranslatef(-1.5f, 0.0f, -6.0f);			

	glRotatef(rtri, 0.0f, 1.0f, 0.0f);

	glBegin(GL_TRIANGLES);					
		glColor3f(1.0f, 0.0f, 0.0f);			
		glVertex3f(0.0f,  1.0f, 0.0f);			
		glColor3f(0.0f, 1.0f, 0.0f);			
		glVertex3f(-1.0f, -1.0f, 0.0f);			
		glColor3f(0.0f, 0.0f, 1.0f);			
		glVertex3f( 1.0f, -1.0f, 0.0f);			
	glEnd();

	glLoadIdentity();					
	glTranslatef(1.5f, 0.0f, -6.0f);			
	glRotatef(rquad, 1.0f, 0.0f, 0.0f);		

	glColor3f(0.5f, 0.5f, 1.0f);				
	glBegin(GL_QUADS);					
		glVertex3f(-1.0f,  1.0f, 0.0f);			
		glVertex3f( 1.0f,  1.0f, 0.0f);			
		glVertex3f( 1.0f, -1.0f, 0.0f);			
		glVertex3f(-1.0f, -1.0f, 0.0f);			
	glEnd();

	rtri += 0.2f;						
	rquad += -0.15f;					

	return TRUE;						
}
  
Thanks, HardSniper

Share this post


Link to post
Share on other sites