Archived

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

jimmyjames

Newbie - view orientation question?

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
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