View Full Version : glRenderMode(GL_RENDER) is slow with VBO.

05-27-2014, 10:17 PM

I am using VBO as my rendering method and i have lots of object to draw with lakhs of triangles.
now my issuse is if I select any object using mouse by glRenderMode method it works slow.

05-29-2014, 08:36 AM
GL_RENDER is the default value for glRenderMode. So calling glRenderMode(GL_RENDER) should have absolutely no effect on performance.

Can you clarify what your problem is? From your description, it sounds like you might be using selection mode, which would be glRenderMode(GL_SELECT)? Is selection mode slow? Or are you saying that rendering is slower after you use selection mode, and switch back to rendering mode?

05-29-2014, 09:38 PM
I am rendering 1000 mesh in opengl 4.4.0 version using VBO now issue came from selecting or say picking object from opengl screen.
below is my code.

DWORD dwTime = GetTickCount();
float m_fLen = 28.0f;
float m_fAspectRatio = 1.3f;
int viewportCoords[4] = {0};
glGetIntegerv(GL_VIEWPORT, viewportCoords);
gluPickMatrix(x,y,5,5, viewportCoords);
glOrtho((-m_fLen * m_fAspectRatio), (m_fLen * m_fAspectRatio), -m_fLen, m_fLen, -m_fLen*100.0f, m_fLen*100.0f);
m_iObjectsFound = glRenderMode(GL_RENDER);
DWORD dwEndTime = GetTickCount()-dwTime;

dwEndTime = 1300 average time for my selecting objects using mouse event.

06-02-2014, 11:38 PM
I figure you draw your objectsfor picking between the glOrtho() call and the glRenderMode(GL_RENDER) call?

I'm not really sure what realistic expectations are for performance of selection. It's such an old and obsolete feature that I doubt it's heavily optimized in drivers. I don't think any modern hardware has support for it, so I would expect it to be running completely in software. If you have a lot of primitives/triangles, I'm not surprised if it takes a while.

06-03-2014, 02:49 PM
I figure you draw your objectsfor picking between the glOrtho() call and the glRenderMode(GL_RENDER) call?
You mean you didn't see any drawing in the code? :)
So, yes this code does nothing.

Second, GetTickCount() is very imprecise function. Error is about 15ms. Useless for this purpose.

Third, every glGet*() function is expensive.

Forth, I have never noticed performance problem with legacy picking since it is a very rare action. Picking occurs once in several seconds and probably for some stationary objects/scene. Pick matrix creates a very narrow viewing frustum which excludes most of the scene from drawing. Maybe it is not fully HW accelerated, but it works pretty well.