PDA

View Full Version : glGetDoublev(GL_PROJECTION_MATR, ...) on Windows 7



devdept
01-05-2010, 02:25 AM
Hi All,

Is it possible that the call to glGetDoublev(GL_PROJECTION_MATRIX,...) is significantly slower than glGetDoublev(GL_MODELVIEW_MATRIX, ...) on Windows 7 ?

Is there any meaningful reason for this?

Should I look for a new graphics driver?

Thanks,

Alberto

ZbuffeR
01-05-2010, 04:43 AM
If you care about performance, avoid any glGet*.
What are your measured times in milliseconds, for each call ? Is it different with different OS versions, or with glGetFloatv(*) ?

devdept
01-05-2010, 04:54 AM
I can understand a difference between different OS but not 1.6 sec for getting projection matrix and 0.001 sec for getting model view one, what do you think?

Thanks,

Alberto

EDIT: those timing are actually for calling glGetDoublev() 100 times...

ZbuffeR
01-05-2010, 04:59 AM
16 ms is not that slow for something nobody should use ;) Well my idea is that it is not optimized at all. Maybe only modelview is cached by the driver.
BTW, what driver/hardware is that ?
Any difference with the glGetFloatv versions ?

devdept
01-05-2010, 05:22 AM
Just noticed that after upgtrading to Windows 7 a Microsoft driver came into play.

Ok, so you recommend to use custom glOrtho/Perspective and keep a copy of the matrices in memory?

Thanks,

Alberto

dukey
01-05-2010, 10:42 AM
grab the values as floats
no doubt the driver only uses floats anyway

peterfilm
01-05-2010, 11:19 AM
you should never use any glGet functions in your render loop. In other words, it's fine to use them to grab limits, such as maximum texture size etc. but only at initialisation time. Sometimes you'll be lucky and the glGet won't make your app synchronise with the GL implementation, but a lot of the time it will (ie. your render thread will stall waiting for the driver thread to get to your glGet request).

devdept
01-05-2010, 12:54 PM
It's the first time we see this kind of slow down with glGetXxx....

Again, do you recommend to copy glOrtho/glPerspective/gluLookAt source code inside our app and keep a reference to those matrices without using glGetDoublev()?

Thanks,

Alberto

Brolingstanz
01-05-2010, 01:42 PM
“... and glGet, virtual memory allocations and a healthy dose of gratuitous file IO never hurt anybody."
-- Binglebrook Botch in “On the Immovable Object and Irresistible Force: Ruminations on a Midsummer’s Morn”

Alfonse Reinheart
01-05-2010, 03:07 PM
Again, do you recommend to copy glOrtho/glPerspective/gluLookAt source code inside our app and keep a reference to those matrices without using glGetDoublev()?

I recommend changing whatever code you're using that actually needs to know the full projection matrix. You passed glPerspective the parameters, so clearly you have the matrix (or something close to it). If you're using gluLookAt, then you know what the camera point is, and what the direction of view is.

In short, there is no reason why you need the projection matrix on the CPU in matrix form. Unless you're doing CPU transformations. In which case yes, you should replicate this code in your application.

devdept
01-06-2010, 05:01 AM
I got the point, thanks.

devdept
01-08-2010, 12:41 AM
I finally discovered why I was experiencing so many issue under Windows 7 x64 after upgrading from Windows Vista x64. The OpenGL version is 1.1.0 therefore I am currently using the Microsoft Generic driver.

Is it possible that a Windows 7 driver for my ATI FireGL 7200 is not available?

I tried downloading the following two drivers from AMD.com:

FirePro_8.663.3_Win7x64_91195.exe
FirePro_8.583_Vista64_77160.exe

but cannot be installed (the install program disappears without reason).

Any help is greatly appreciated thanks.

Alberto