[gameprogrammer] OpenGL... Where are the calculations made?

  • From: "richard sabbarton" <richard.sabbarton@xxxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Wed, 7 May 2008 08:32:41 +0100

Hi Guys,

I have another question regarding OpenGL and I am hoping you can clear
something up for me.  If I run matrix manipulation functions using
OpenGL (e.g. glTranslate(), glRotate(), gluLookAt(), etc.) I am
assuming that the calculations required to perform these functions are
performed by the GPU on the Graphics adapter rather than the CPU.  Is
this correct?  Does that mean that the glMatrix is stored in the
memory of the graphics adapter or in my system RAM?  I am asking
because I assume that the GPU can process these calculations quicker
and more efficiently than the CPU can.

For example, if I want to calculate a cross-product or face normal I
can use sin(), cos(), etc to perform the calculations but, IMO, these
can be quite costly as far as CPU time.  So what if, instead of using
sin() & cos() I was to use glXxxx functions instead.  I could load an
identity matrix and then use gluLookAt() to look at point A and supply
point B as an Up Vector.  I can then translate 1.0 along the X axis
and pluck my normalised cross-product from the matrix.  No sin(),
cos() or sqrt() in sight.  Do you think this will be quicker?  Also, I
am not sure about the overhead of pulling the values from the Matrix
as (another assumtion) would this involve copying the matrix from the
Graphics Memory into the System Memory?

Regards

Richard

---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: