开发者

GLSL Shaders Attributes as ints

开发者 https://www.devze.com 2023-01-17 11:30 出处:网络
I\'m just learning Ope开发者_如何转开发nGL and I\'m running into some issues.I\'m using OpenGL 3.0 and GLSL 1.2.

I'm just learning Ope开发者_如何转开发nGL 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.


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

0

精彩评论

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