gluPerspective() after glOrtho
Hei Everybody!
I just started to study OpenGL and have some problems with perspective projection.
I have a program in which a cube bouncing on the screen. If I create my 3D space like
glOrtho(-range,range,-range,range,-range,range)
it works without any troubles. But if I change to
gluPerspective(angle,aspect,1.0,2*range)
or
glFustrum(-range,range,-range,range,-range,range)
Either I can't see anything in my window or I can notice that my viewing-point is somewhere 'in the created space' and the cube can go 'behind me'.
How could I manage to see the same space just like with glOrtho?
Is it necessary to use gluLookAt(...) with glPerspective? What is the default viewing-point after creating a space with gluPerspective? Is there a process to calculate gluPerspective() from glOrtho?
Thx: tmgergo
I just started to study OpenGL and have some problems with perspective projection.
I have a program in which a cube bouncing on the screen. If I create my 3D space like
glOrtho(-range,range,-range,range,-range,range)
it works without any troubles. But if I change to
gluPerspective(angle,aspect,1.0,2*range)
or
glFustrum(-range,range,-range,range,-range,range)
Either I can't see anything in my window or I can notice that my viewing-point is somewhere 'in the created space' and the cube can go 'behind me'.
How could I manage to see the same space just like with glOrtho?
Is it necessary to use gluLookAt(...) with glPerspective? What is the default viewing-point after creating a space with gluPerspective? Is there a process to calculate gluPerspective() from glOrtho?
Thx: tmgergo
gluPerspective can't make the same view as Ortho, that's why there are two functions.
The eye will default to 0,0,0 looking at 0,0,1 (or is that 0,0,-1, I never remember) with a perspective.
You can change that however you like, but gluLookAt is one of the easiest ways to manage it.
The eye will default to 0,0,0 looking at 0,0,1 (or is that 0,0,-1, I never remember) with a perspective.
You can change that however you like, but gluLookAt is one of the easiest ways to manage it.
OneSadCookie Wrote:(or is that 0,0,-1, I never remember)
Yup, {0.0, 0.0, -1.0} is correct.
- Alex Diener
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Small error with glViewport and gluPerspective? | cjcaufield | 1 | 2,871 |
Sep 20, 2009 01:10 AM Last Post: DoG |
|
| HELP!!! Simple glOrtho problem! | Marvin | 3 | 3,493 |
Jun 27, 2007 10:23 AM Last Post: Marvin |
|
| OpenGL Texture in relation to GL orientation, and... glOrtho help. | Jones | 6 | 4,441 |
Jun 30, 2006 07:18 PM Last Post: arekkusu |
|
| glOrtho setup for rendering "impostors" into a texture. | TomorrowPlusX | 22 | 7,522 |
May 22, 2006 07:21 AM Last Post: TomorrowPlusX |
|
| picking glOrtho vs gluPerspective | rhiannon | 0 | 3,082 |
Jun 6, 2005 02:20 PM Last Post: rhiannon |
|

