Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm doing a small direct3d11 project for "fun". I know d3d11 quite well but not really any opengl. My program is designed for d3d11 but I would like it to be easy to port to opengl at some point so I'm trying to keep to abstractions that are somewhat portable. The concepts of vertex buffer, index buffers, vertex shaders, pixel shaders, and some form of input layout structures all seem to map pretty well.

But what about constant buffers? all of the examples I see of opengl shaders have code getting "pointers" to named variables in the shader and setting them whereas my code for d3d11 just creates a big c++ struct and copies it into a constant buffer. This then maps directly to a cbuffer in the shader.

Does the same concept exist in opengl? I've been unable to find it with any quick searches. Or do I have to set named variables only?

share|improve this question
Could this be it? – teodron Sep 3 '13 at 8:02
That looks exactly like it, thank you. The problem sometimes is knowing what to search for when you don't know what something is called in opengl. Please put it as an answer I can accept. – JohnB Sep 3 '13 at 8:04
up vote 4 down vote accepted

The OpenGL most closest equivalent of constant buffers might be the Uniform Buffer Object.

More details in the link above.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.