开发者

OpenGL Shaders and constants

开发者 https://www.devze.com 2023-02-18 09:42 出处:网络
I need to access a bunch of constant values in my GLSL geometry shader. I tried it this way: const int lookup[HUGE_NUMBER] = 开发者_Python百科int[HUGE_NUMBER](1,32,...)

I need to access a bunch of constant values in my GLSL geometry shader. I tried it this way:

const int lookup[HUGE_NUMBER] = 开发者_Python百科int[HUGE_NUMBER](1,32,...)

This works... for some hardware. On ATI cards I'm getting warnings that the size of my geometry shader may cause poor performance (sounds reasonable). On other cards (NV) the shader won't link because of insufficient memory. Defining constant arrays seems to be a unsupported hack.

So - what's the way to go? I've read of "constant buffers" in the DirectX pipeline. Is there anything similar? Or do I have to use textures?


You can go with at least any of the following interfaces:

  1. Texture
  2. Uniform buffer object
  3. Texture buffer
0

精彩评论

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