Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: glRenderMode(GL_RENDER) is slow with VBO.

  1. #1
    Junior Member Newbie
    Join Date
    May 2014
    Posts
    7

    glRenderMode(GL_RENDER) is slow with VBO.

    Hello,

    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.

  2. #2
    Intern Contributor
    Join Date
    Mar 2014
    Location
    San Jose, CA
    Posts
    58
    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?

  3. #3
    Junior Member Newbie
    Join Date
    May 2014
    Posts
    7
    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};
    memset(m_uiSelectedBuffer,0,200);
    glSelectBuffer(200,m_uiSelectedBuffer);
    glRenderMode(GL_SELECT);
    glMatrixMode(GL_PROJECTION);
    glPushMatrix();
    glLoadIdentity();
    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;
    glMatrixMode(GL_PROJECTION);
    glPopMatrix();
    glMatrixMode(GL_MODELVIEW);

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

  4. #4
    Intern Contributor
    Join Date
    Mar 2014
    Location
    San Jose, CA
    Posts
    58
    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.

  5. #5
    Senior Member OpenGL Pro Aleksandar's Avatar
    Join Date
    Jul 2009
    Posts
    1,141
    Quote Originally Posted by reto.koradi View Post
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •