5

What is the difference between uniforms and constant buffers?

Are they completely separate or can the uniforms be seen as in a constant buffer? In other words, if you want to set a uniform, do you need a constant buffer or is there another way?

I ask because I have four variables (float2 pan, float scale and float rotation) that will in all likelihood not be changing at the same time. Do I need a constant buffer to set them all at once or is it better to set them individually, if possible?

jnm2
  • 7,960
  • 5
  • 61
  • 99

1 Answers1

-1

Uniforms are used when you have a variable that will be assigned from a external source from outside the function. In your case of the uniforms declaration will be better because you said that you will not be changing at the same time. The const declaration makes the variable unchangeable. Check out this page for resources..http://www.opengl.org/sdk/docs/tutorials/ClockworkCoders/uniform.php

  • 1
    This answer is wrong. This is for HLSL, how is Open GL documentation helpful here??? He's asking about the difference between a uniform variable and a constant buffer, not uniform and constant. – Mike Aug 23 '13 at 03:02