Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

jimmyjames

Newbie - view orientation question?

This topic is 5527 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

I''m tring to write a 2d game, but I cant figure out how much of the screen (in pixels) that is actually being viewed on my screen? I''m a little confused on what the boundries are. I know that the camera is at 0,0,20 and it''s pointing to 0,0,-10, but what are the sides of the screen''s dimensions? Here''s my code so far. screen res at 640x480 glViewport(0,0,width,height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(90.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f); gluLookAt(0.0f, 0.0f, 20.0f, 0.0f, 0.0f, -10.0f, 0.0f, 1.0f, 0.0f); .....help!

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Firstly, there is somthing you are doing wrong.
glViewport(0,0,width,height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);
glMatrixMode(GL_MODELVIEW)//forgot if its MODELVIEW or something else
gluLookAt(0.0f, 0.0f, 20.0f, 0.0f, 0.0f, -10.0f, 0.0f, 1.0f, 0.0f);


Anyway, u have to change the matrix mode to modelview b4 u can use gluLookAt.

The number of pixels that u are viewing is defined by your viewport.
So its width X height.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Firstly, there is somthing you are doing wrong.
glViewport(0,0,width,height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);
glMatrixMode(GL_MODELVIEW)//forgot if its MODELVIEW or something else
gluLookAt(0.0f, 0.0f, 20.0f, 0.0f, 0.0f, -10.0f, 0.0f, 1.0f, 0.0f);


Anyway, u have to change the matrix mode to modelview b4 u can use gluLookAt.

The number of pixels that u are viewing is defined by your viewport.
So its width X height.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!