Sign in to follow this  
Winegums

Implied 2d in OpenGL

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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:

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 );
}
}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this