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 2 of 2

Thread: Overhead with glEnable / glDisable ?

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2005
    Location
    canada
    Posts
    5

    Overhead with glEnable / glDisable ?

    Simple question: is there any signicant overhead in calling glEnable or glDisable? As in, if I am enabliing or disabling many times per frame, is this just setting a flag or is it doing much more each call?

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,651

    Re: Overhead with glEnable / glDisable ?

    Hi !

    That depends on your hardware, you should try to minimize any state changes as much as possible, one example is to try to collect many things that use the same attributes and render them all at the same time, so just as an example:

    Code :
    glDisable( GL_LIGHTING);
    render stuff that does not use lighting
    glEnable( GL_LIGHTING);
    render everything that does depend on lighting
    Some times is of course not possible, and many state change does not take much time at all, I guess that also depnds on what you are disabling/enabling.

    Mikael

Posting Permissions

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