[cello-devel] solved: Freeglut the win32 cpu hog, and the Mystery of the Z-Axis

Kenny Tilton ktilton at nyc.rr.com
Tue Mar 9 22:54:17 UTC 2004


I never got time to look at it, but apparently the f/g cpu hogging was a 
known issue allowed into a release just to make some external deadline. 
Based on the f/g list activity, it sounds fixed in the current sources. 
Now only if I could figure out again how cvs works. :)

btw, I also made one small step for Kenny in re the z-axis and 
gl-translatef: they were not lying. Translate moves the matrix. So 
imagine with gl-ortho we make the near plane +500 and the far plane 
-500. That means the negative z-axis runs deeper into the screen. To 
draw a cube, the front face vertices might all have z-value 1, the back 
face vertices would all have z-value -1.

Now suppose you draw one cube at (0 0 0) and you want to draw a second 
cube directly behind it. You can use a generic cube instance with the 
same vertices, but you have to re-orient within the world before drawing 
those vertices, or you end up with two things in the same place.

We use gl-translate to re-orient. We want to draw the second cube two 
units deeper. Deeper is negative, so we translate thus:

   (gl-translatef 0 0 2) ;; surprise, surprise

Translating moves the matrix /forward/ two so that the plane at -2 is 
now where vertices drawn with depth (Z=) 0 will appear when the whole 
rendering pipeline is done.

My problem was that I had started to think of gl-translate as moving the 
drawing position, so I got all messed up.

kt

-- 
http://tilton-technology.com

Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film 

Your Project Here! http://alu.cliki.net/Industry%20Application






More information about the cello-devel mailing list