• Create Account

## perspective question

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

3 replies to this topic

### #1omegasyphon  Members

100
Like
Likes
Like

Posted 09 August 2001 - 03:00 PM

alright in my program it started out using an ortho view but when i try to convert it to a perspective view, my scene doesnt show up where it should be on screen. here is my function
  void ChangeSize(int w, int h) { GLfloat FAspect, nRange= 150.0f; // Prevent a divide by zero if(h == 0) h = 1; // Set Viewport to window dimensions glViewport(0, 0, w, h); FAspect = (GLfloat)w / (GLfloat)h; // Reset projection matrix stack glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(60.0f,FAspect,-500.0f,500.0f); /* // Establish clipping volume (left, right, bottom, top, near, far) if (w <= h) glOrtho (-nRange, nRange, -nRange*h/w, nRange*h/w, -nRange, nRange); else glOrtho (-nRange*w/h, nRange*w/h, -nRange, nRange, -nRange, nRange); */ // Reset Model view matrix stack glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } 

### #2blackbird  Members

122
Like
Likes
Like

Posted 10 August 2001 - 06:23 AM

one thing the near and far clipping planes should always be positive.
so try: gluPerspective(60.0f, FAspect,1.f , 500.f);

and then use gluLookAt(...) to position the camera

something like this: gluLookAt( 0.f,0.f,-150.f, // eye
0.f,0.f,0.f, // look at
0.f,1.f,0.f); // up dir.

### #3omegasyphon  Members

100
Like
Likes
Like

Posted 11 August 2001 - 12:38 AM

thankyou adding glulookat seemed to solve the problem

### #4omegasyphon  Members

100
Like
Likes
Like

Posted 13 August 2001 - 01:36 AM

how would i adjust the camera on the terrain ie close far away. way to the right or left

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.