PDA

View Full Version : Selection speed issue



pixelPhile
12-16-2003, 07:57 AM
I am using GL_SELECT to draw simple quads to assist me in clipping my scene.
In the first quad drawn ONLY, and ONLY for the first time the scene is rendered, the first call to glVertex3f takes around 300ms, whereas every subsequent call takes around 30us (10,000 times less). If the first thing I do is to actually render something (GL_RENDER) instead pseudo-drawing it with GL_SELECT, I don't get the delay (but I guess I would, the first time I use select mode).

Can anyone explain this behaviour?

(I'm running an NVIDIA Quadro4 580 XGL on 2.8 GHz P4)

Korval
12-16-2003, 09:58 AM
Remember, selection runs in software mode. nVidia's drivers probably want to make sure you're serious about using selection, so they differ allocations until you actually draw something in selection mode. So, part of that 300ms time is likely memory allocations and whatever setup they need for their software rasterizer.

Csiki
12-16-2003, 11:32 AM
Use occlusion queries instead.

pixelPhile
12-16-2003, 11:51 PM
Originally posted by Csiki:
Use occlusion queries instead.

Thanks for the suggestion. Seems to me that occlusion queries only work in version 1.5 and on NVIDIA cards - is that right? I'm working on Windows XP, which reports version 1.2, and I can't afford to be hardware specific. Also, assming Korval is right, is there any reason to expect occlusion queries to be more efficient or incur a lower overhead?

pixelPhile
12-16-2003, 11:55 PM
Originally posted by Korval:
Remember, selection runs in software mode. nVidia's drivers probably want to make sure you're serious about using selection, so they differ allocations until you actually draw something in selection mode. So, part of that 300ms time is likely memory allocations and whatever setup they need for their software rasterizer.

Thanks. That makes sense, although 300ms is _forever_! I think I need an alternative approach (which I'm discussing on the maths and algorithm forum).

Csiki
12-17-2003, 02:01 AM
Originally posted by pixelPhile:
Also, assming Korval is right, is there any reason to expect occlusion queries to be more efficient or incur a lower overhead?
Korval is right, and yes, occlusion queries are more efficient.

pixelPhile
12-17-2003, 02:10 AM
Good, but I'd be interested to know the reason they are more efficient (e.g., are they done in hardware?)

Mazy
12-17-2003, 02:41 AM
yes, they are in HW.. and occlusion queries are implemented on more cards, just check for the extension ( i know that ATI implements them, even in lower versions of openGL than 1.5)

pixelPhile
12-17-2003, 02:42 AM
Thanks very much.