Replacing Built-in Attribs

I’m writing a shader for the GLSL 1.2 but at the same time I want my shader to be forward compatible so that it does not use built-in attributes and uniforms, such as gl_Vertex, glModelViewProjectionMatrix.

Is it possible to define my own, for example instead of using gl_vertex,

attribute vec4 position

or in vec4 position

Does this has any performance implication when used in shader version 1.2?

Thanks.

You bet. Just use glBindAttribLocation to nail your name “position” to a specific generic vertex attribute index.

Alternatively, let the shader assign the number and then query it and use that number when setting up vertex attributes for batches.

Yup, this is the preferred method now.

No more predefined vertex attributes. All should be named by the application/shader combination using the ascii attribute variable name in the shader.

It’s a beautiful thing :slight_smile: