Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What is the general form of an OpenGL program?

form OpenGL program
0
10 Posted

What is the general form of an OpenGL program?

0
10

There are no hard and fast rules. The following pseudocode is generally recognized as good OpenGL form. program_entrypoint { // Determine which depth or pixel format should be used. // Create a window with the desired format. // Create a rendering context and make it current with the window. // Set up initial OpenGL state. // Set up callback routines for window resize and window refresh. } handle_resize { glViewport(…); glMatrixMode(GL_PROJECTION); glLoadIdentity(); // Set projection transform with glOrtho, glFrustum, gluOrtho2D, gluPerspective, etc. } handle_refresh { glClear(…); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // Set view transform with gluLookAt or equivalent // For each object (i) in the scene that needs to be rendered: // Push relevant stacks, e.g., glPushMatrix, glPushAttrib. // Set OpenGL state specific to object (i). // Set model transform for object (i) using glTranslatef, glScalef, glRotatef, and/or equivalent. // Issue rendering commands for object (i).

0

There are no hard and fast rules. The following pseudocode is generally recognized as good OpenGL form. program_entrypoint { // Determine which depth or pixel format should be used. // Create a window with the desired format. // Create a rendering context and make it current with the window. // Set up initial OpenGL state. // Set up callback routines for window resize and window refresh. } handle_resize { glViewport(…); glMatrixMode(GL_PROJECTION); glLoadIdentity(); // Set projection transform with glOrtho, glFrustum, gluOrtho2D, gluPerspective, etc. } handle_refresh { glClear(…); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // Set view transform with gluLookAt or equivalent // For each object (i) in the scene that needs to be rendered: // Push relevant stacks, e.g., glPushMatrix, glPushAttrib. // Set OpenGL state specific to object (i). // Set model transform for object (i) using glTranslatef, glScalef, glRotatef, and/or equivalent. // Issue rendering commands for object (i). //

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123