Newbie - view orientation question?
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!
All your bases are belong to me......
May 30, 2003 12:11 AM
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.
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.
May 30, 2003 12:11 AM
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement