|
OpenGL, glFrustum and Perspective |
Albin Engström
Member #8,110
December 2006
|
well, I'm using openGL now and I'm trying to get used to it (again) but some things are troubling me, first of all what do i have to do to not have to call glFrustrum after every time i call glLoadIdentity? if i don't the objects untill next call to glFrustrum wont draw . another problem is that I'm trying to get the perspective right, and right in this case means no perspective at all(i hope I'm thinking of the right thing), i want objects that are far away to be drawn exactly as large as the objects near the camera, but i cant fix it.. glut had some perspective fixing function if i recall correctly, how would i do this with "pure" openGL functions? thanks a lot! |
Tobias Dammers
Member #2,604
August 2002
|
First of all, glFrustum goes into the PROJECTION matrix, and unless you need to overlay something, you set that once (or once per frame) and then switch to the MODELVIEW matrix, which is where you translate, rotate and scale your world and objects. They're explained in the OpenGL red book and blue book (look for glMatrixMode). So, in short, rendering a frame goes like so: --- |
Krzysztof Kluczek
Member #4,191
January 2004
|
Quote: This is in fact an isometric projection It's orthogonal projection, not isometric one. Isometric projection happens only when projections of unit X, Y and Z vectors are equally long and angles between them are exactly 120 degrees. ________ |
Albin Engström
Member #8,110
December 2006
|
Thanks a lot! , things look MUCH better now. |
Carrus85
Member #2,633
August 2002
|
Quote:
So, in short, rendering a frame goes like so: Just as a note you should be able to do steps 1-3 only once on the first frame; you don't have to do it again and again every frame, as long as you leave the projection matrix alone. (AFAIK; this has always worked for me, but it might be driver dependant )
|
Krzysztof Kluczek
Member #4,191
January 2004
|
Quote: Just as a note you should be able to do steps 1-3 only once on the first frame; you don't have to do it again and again every frame, as long as you leave the projection matrix alone. (AFAIK; this has always worked for me, but it might be driver dependant ) It doesn't depend on driver or at least shouldn't if driver wants to comply with OpenGL specification. You can even remove step 2 as all matrices are identity matrices by default and you can do step 4 just once. ________ |
Albin Engström
Member #8,110
December 2006
|
noted . |
|