简体   繁体   中英

GLSL Shaders Attributes as ints

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM