Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

9. Optimization > Minimize State Changes

Minimize State Changes

OpenGL ES contexts store a large amount of information to control rendering operations. Some of the information is cached in CPU controlled memory and other information is stored within registers in the GPU. Changes to the context’s state always require some CPU overhead and might slow the GPU’s as register values change. In particular, avoid unnecessary calls to glBindBuffer() and glVertexAttribPointer() as well as glEnable() and glDisable() in all their variants such as glEnableVertexAttribArray(). After a mode is enabled, it doesn’t need to be reenabled. Calling glEnable() more than once for the same mode provides no benefit and wastes CPU time. For example, calling glEnable(GL_DEPTH_TEST) more than once wastes time updating the context’s state even if the value is identical to the current value.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial