Shoe
Shoe

Reputation: 76298

Setting uniform in OpenGL

I have an uniform in the form of:

uniform float abc;

and I get it in Haskell code as:

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

How can I pass a GLfloat value to it?

I see from here that I should probably be using uniform1, but that function is not exported by the module.

Every other instance:

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)

does not seem to cover this simple case.

What can I do?

Upvotes: 4

Views: 218

Answers (1)

Shoe
Shoe

Reputation: 76298

Apparently it's a known bug in the API.

A possible alternative for now is to use the Index1 overload, which is supposed to be a color index, but works fine with simple floats.

Upvotes: 3

Related Questions