开发者

HLSL uniform variables vs constant buffers

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 开发者_Go百科them individually, if possible?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜