在OpenGL中设置统一

时间:2015-04-04 18:51:02

标签: opengl haskell glsl

我在表单中有一个制服:

uniform float abc;

我在Haskell代码中得到它:

abc <- GL.get (GL.uniformLocation program "abc")

如何将GLfloat值传递给它?

我从here看到我应该使用uniform1,但该功能不会被模块导出。

其他所有实例:

instance UniformComponent a => Uniform (Vertex2 a)
instance UniformComponent a => Uniform (Vertex3 a)
instance UniformComponent a => Uniform (Vertex4 a)
instance UniformComponent a => Uniform (TexCoord1 a)
instance UniformComponent a => Uniform (TexCoord2 a)
instance UniformComponent a => Uniform (TexCoord3 a)
instance UniformComponent a => Uniform (TexCoord4 a)
instance UniformComponent a => Uniform (Normal3 a)
instance UniformComponent a => Uniform (FogCoord1 a)
instance UniformComponent a => Uniform (Color3 a)
instance UniformComponent a => Uniform (Color4 a)
instance UniformComponent a => Uniform (Index1 a)

似乎没有涉及这个简单的案例。

我该怎么办?

1 个答案:

答案 0 :(得分:3)

API中显然是it's a known bug

现在可能的替代方法是使用Index1重载,它应该是一个颜色索引,但是对于简单的浮点数可以正常工作。