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

Thread: Question about glDisable/glEnable

Hybrid View

  1. #1
    Newbie Newbie
    Join Date
    Dec 2012
    Posts
    2

    Question about glDisable/glEnable

    Hi,
    I'm coding a small rendering engine with OpenGL and I have a doubt about glEnable/glDisable:

    In my rendering loop I first set a bunch of default states (TEXTURE_2D and vertex/color arrays), then each single object draws itself and finally the default states are disabled before swapping buffers. What I am unsure about is: is it more efficient to enable those default states only once and leave them enabled all the time instead of disabling/enabling them at the start/end of each loop?

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    985
    The fastest way to do things is to not do them. What I mean here is that if you know that the state doesn't change between objects then don't change it.
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

  3. #3
    Newbie Newbie
    Join Date
    Dec 2012
    Posts
    2
    Ok, perfect. Thanks for your advice!

Posting Permissions

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