简体   繁体   中英

OpenGL: glVertexAttribFormat.attribindex vs GLSL vertex shader location

Does the attribindex in glVertexAttribFormat correspond with the layout location in my GLSL vertex shader?

ie if I write

glVertexAttribFormat(0, 3, GL_FLOAT, GL_FALSE, offsetof(Vertex, position));

That 0 would correspond with this line in my shader?

layout (location = 0) in vec3 inPos;

Yup. Otherwise without a location specifier you have to query the attribute location via glGetAttribLocation() after program linking or set it before program linking via glBindAttribLocation() .

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