Advertisement

Question about DrawGLScene()

Started by November 06, 2001 06:43 PM
2 comments, last by HardSniper 23 years, 3 months ago
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
HardSniper
The awnser to your question lies in winmain...
Advertisement
Yeah... the reason you don''t see a loop in there is because there is none.
lol, i completely missed the while surrounding the if statement... Thanks,

HardSniper
HardSniper

This topic is closed to new replies.

Advertisement