tags:

views:

40

answers:

1

Hello,

I'm just learning OpenGL and I'm running into some issues. I'm using OpenGL 3.0 and GLSL 1.2.

I have an array of matrices which I would like to selectively apply to different vertices. Instead of copying a matrix each time I want to indicate an index, I would instead like to pass in an integer as an index and use that integer to select the matrix I want. However, when I try to compile my shader I get the following error:

ERROR: 0:5: 'attribute' : cannot be bool or int

I'd appreciate it if anybody could point me in the right direction.

+1  A: 

Attributes can be ints, but you need to enable a newer version of GLSL to use it. Try adding this to the top of your shader:

#version 130

Version 130 corresponds to OpenGL 3.0

Matias Valdenegro
and for sending such attributes to the shader instead of glVertexAttrib* use its integer version - glVertexAttribI*
erjot
I'm using Mac OS X, which wont support 130. Still, good to know. Thanks for the reply.
helixed
Then you aren't using OpenGL 3.0... You're out of luck.
Matias Valdenegro