Implied 2d in OpenGL
Hi, im planning on making a game with implied 2d. the player will be a 3d model, but all enemies and enviromental features will be 2d. i was hoping someone could advise me as to the best way to go about doing this? is there a camera mode that i would benefit from using, or should i just orientate the camera to a position facing down the z axis and have all movement along the x-y axis?
You could do that, Ortho mode might be useful to you as well. Why a 3D player model but 2D the rest?
Here is an example of switching into 640x480 ortho:
Here is an example of switching into 640x480 ortho:
void CRendererOGL::ToggleOrthoMode( bool bFlag ){ if( bFlag == true ) { int vPort[4]; glGetIntegerv( GL_VIEWPORT, vPort ); glMatrixMode( GL_PROJECTION ); glPushMatrix( ); glLoadIdentity( ); // Should use the data from vPort here. glOrtho( 0, 640, 0, 480, -1, 1 ); glMatrixMode( GL_MODELVIEW ); glPushMatrix( ); glLoadIdentity( ); glDisable( GL_DEPTH_TEST ); } else { glMatrixMode( GL_PROJECTION ); glPopMatrix( ); glMatrixMode( GL_MODELVIEW ); glPopMatrix( ); glEnable( GL_DEPTH_TEST ); }}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement