Swapping buffers multiple times in one function (OpenGL and C++) -
Swapping buffers multiple times in one function (OpenGL and C++) -
i'm using opengl display function contains next lines of code:
glclear(gl_color_buffer_bit | gl_depth_buffer_bit); glmatrixmode(gl_projection); glloadidentity(); glmatrixmode(gl_modelview); //draw stuff glmatrixmode(gl_projection); glpopmatrix(); glmatrixmode(gl_modelview); glpopmatrix(); glutswapbuffers(); however, i'm applying code multiple times throughout function. want happen draw something, respond user's input, draw else, respond user's input 1 time again , draw 1 lastly thing. considered acceptable practice phone call "glutswapbuffers" multiple times in same function? if it's not huge problem, there way create display final drawing? draws first 2 pictures want to, 3rd time screen stays white.
usually create loop
check input @ origin of loop , update variables , draw 1 time depending on variables , restart loop.
if no input comes in variables don't depend on time remain same , draw remain same.
c++ opengl buffer swap
Comments
Post a Comment