Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 12 Dec 2008
Offline Last Active Nov 23 2013 02:10 AM

Topics I've Started

Getting order of attributes, as specified in shader file.

21 November 2013 - 08:59 PM



I am writing an OpenGL shader loader. Currently, once I have linked the shader program, I am looping through each active attribute using glGetObjectParameterivARB(m_uiShaderID, GL_OBJECT_ACTIVE_ATTRIBUTES_ARB, &iCount), and calling glGetActiveAttrib() using the loop index, and then glBindAttribLocation() with the index and the name returned from glGetObjectParameter.


This approach is not giving me the attributes in the order in which I have specified them in the shader program, for example I have:


in vec4 vPosition;

in vec3 vNormal;


and my loop output gives:


0 vNormal

1 vPosition;


Is there a way I can get the attributes in the correct order, using OpenGL functionality?