Why does SetupRC( ) come before RenderScene?
Shouldn’t SetupRC( ) come before since it sets the glClearColor? How does glClear(GL_COLOR_BUFFER_BIT); know what color to clear with if it goes before SetupRC( )?
#include <windows.h>
#include <gl/glut.h>
// Called to draw scene
void RenderScene(void)
{
// Clear the window with current clearing color
glClear(GL_COLOR_BUFFER_BIT);
// Flush drawing commands
glFlush();
}
// Setup the rendering state
void SetupRC(void)
{
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
}
// Main program entry point
void main(void)
{
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutCreateWindow(“Simple”);
glutDisplayFunc(RenderScene);
SetupRC();
glutMainLoop();
}
I’d appreciate any response to this message.
Thanx,
Y-T