Wake up the graphics with
_pgraphics->activate().
This calls
::wglMakeCurrent( _pDC->GetSafeHdc(), _hRC )
Clear the graphics background with
_pgraphics->clear(targetrect).
This calls
::glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
Install the projection and view matrices with these lines.
_pviewpointcritter->loadProjectionMatrix();
_pviewpointcritter->loadViewMatrix();
These in turn call:
::glMatrixMode(GL_MODELVIEW)
::glLoadMatrixf(_pviewpointcritter->attitude().inverse());
::glMatrixMode(GL_PROJECTION)
::gluPerspective (fieldofviewangleindegrees, xtoyaspectratio,
nearzclip, farzclip); //Values from _pviewpointcritter
Draw your game world and then the critters with
pgame()->drawCritters(_pgraphics, _drawflags).
This generates a variety of ::gl
and ::glu
calls like, in the case of polygons
::glEnableClientState(GL_VERTEX_ARRAY);
::glVertexPointer(...);
::glDrawArrays(...);
Send the graphics to your video display with
_pgraphics->display(this, pDC)
This calls
::glFinish();// Tell OpenGL to flush its pipeline
::SwapBuffers( _pDC->GetSafeHdc() ); // Now Swap the buffers
No comments:
Post a Comment