I have been trying to get myself refreshed on OpenGL ES. Whilst doing so, I had the following question in mind:

Does OpenGL have any "caching" mechanism?

For example:

Let's say we draw a stationary triangle with only 3 vertices on the screen; if there will be no transformation applied to the primitive, will OpenGL ES still go through the vertex and fragment shader, drawing the primitive anew every single frame?

Or, does it have any "caching" mechanism, which is smart enough to know that since there is no transformation, a "caching" buffer will display the primitive on the screen bypassing calculations within vertex and fragment shaders so that unnecessary calculations could be reduced/avoided in hopes to enhance frame rate and performance?

Thank you.


1 Answer 1


OpenGL doesn't specify this; individual implementations are allowed to cache data and/or results so long as the output is conformant with the specification.

Note that this kind of caching is probably not what you want.

Caching like this implies that you need some kind of storage for the cached output, as well as comparison between the previous frame and the current frame. An OpenGL implementation is not going to be able to make such a comparison until SwapBuffers is called, at which point it will need to do a full comparison between two frames. So it's actually going to be more efficient (not to mention having simpler code paths in the driver - and OpenGL drivers are already quite complex as-is) to just require the program to re-submit everything every frame.

It would also lead to inconsistent framerates with spikes, which are actually worse than consistent but (hypothetically) lower framerates.

Quake didn't need caching in 1996, it was efficient then, so you shouldn't be thinking that it's inefficient now.

  • \$\begingroup\$ Can you elaborate a bit more on "individual implementations are allowed to cache data and/or results so long as the output is conformant with the specification"? How would on go about doing that (to cache data); and, is there a name for this method? Thanks a lot. \$\endgroup\$
    – Unheilig
    Commented Oct 11, 2016 at 19:52
  • \$\begingroup\$ OK, "implementation" == "OpenGL driver" (not always but it's a good working definition). This would be something that happens behind-the-scenes in driver code - if the driver did it, you wouldn't need to do anything - the driver would just do it, automatically and transparently. And you can be certain that if it was a worthwhile optimization, drivers would do it. \$\endgroup\$ Commented Oct 11, 2016 at 20:09
  • \$\begingroup\$ I see. I thought there might be useful if there existed functions such as glEnableCache.., which would tell GL to use the last frame buffer from now on bypassing both vertex and fragment shader; and when the developer decided that transformation(s) would be applied to primitives at certain point, she could call glDisableCache.., then glTranslate(....), glDraw(..). Those are just function names I made up to illustrate my idea/thought. Thanks again. \$\endgroup\$
    – Unheilig
    Commented Oct 11, 2016 at 21:34
  • \$\begingroup\$ Just a quick question, if you don't mind: would what I mentioned in my previous comment (e.g., glEnableCache..glDisableCache..`,etc.) be a desirable feature to have in modern graphics pipeline such as OpenGL? \$\endgroup\$
    – Unheilig
    Commented Oct 13, 2016 at 6:34
  • \$\begingroup\$ Probably not. You can achieve much the same with FBOs: Render unchanging parts of the scene to a texture and reuse that texture over subsequent frames. \$\endgroup\$ Commented Oct 13, 2016 at 7:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .