Steven Lu
Steven Lu

Reputation: 43447

Can I bind a vertex attribute index from the vertex shader?

On the OpenGL FBO wiki page there is this snippet:

You can also use layout syntax to define this directly in the shader, as you would for attribute indices:

layout(location = 0) out vec4 mainColor; 
layout(location = 1) out vec2 subsideraryInfo; 

This seems to indicate that attribute indices can be specified within a shader, which would simplify things a bit my removing the need for my code to specify attribute locations and such using glBindAttribLocation.

Upvotes: 0

Views: 288

Answers (1)

Mārtiņš Možeiko
Mārtiņš Možeiko

Reputation: 12927

Yes you can do that starting from GLSL 3.30 (OpenGL 3.3). Read here: http://www.opengl.org/registry/doc/GLSLangSpec.3.30.6.clean.pdf (page 35).

Upvotes: 1

Related Questions