• Advertisement
Sign in to follow this  

Game Viewing Problems

This topic is 3533 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, I am currently developing a 2D game using OpenGL. This is my first attempt to program a 2D game but currently, I setted up the framework but there is some problems with the views.
void Resize( int width, int height )
{
	glViewport ( 0, 0, width, height );
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho( 0.0f, width, 0.0f, height, -1.0f, 1.0f );
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
}


I used this code to set up a 2D view. However, when I have something set initially in the position of (50,0). When the game runs, the view will be shifted to the left by 50 units.. Can anyone help me solve this problem?? Thanks. [Edited by - SnowMoo on August 19, 2008 10:40:31 PM]

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by SnowMoo
Hi,

I am currently developing a 2D game using OpenGL. This is my first attempt to program a 2D game but currently, I setted up the framework but there is some problems with the views.

*** Source Snippet Removed ***


I used this code to set up a 2D view. However, when I have something set initially in the position of (50,0). When the game runs, the view will be shifted to the left by 50 units.. Can anyone help me solve this problem?? Thanks.
You'll probably need to post some more code (specifically, any code where you set up or modify the 'modelview' matrix).

Keep in mind though that in some cases at least, applying a translation of (50,0) will have the implied effect of positioning the camera at (-50,0), which sounds a bit like what you're describing.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement