Jump to content
  • Advertisement
Sign in to follow this  
Winegums

Implied 2d in OpenGL

This topic is 4419 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!