Jump to content

View more

Image of the Day

Inventory ! Va falloir trouver une autre couleur pour le cadre D: #AzTroScreenshot #screenshotsaturday https://t.co/PvxhGL7cOH
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Getting order of attributes, as specified in shader file.

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 hayden355   Members   

150
Like
0Likes
Like

Posted 21 November 2013 - 08:59 PM

Hi,

 

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?



#2 Aks9   Members   

1488
Like
2Likes
Like

Posted 22 November 2013 - 02:07 AM

Yes. By using layout location qualifier.
For example: layout (location = 0) in vec4 vPosition;

#3 hayden355   Members   

150
Like
0Likes
Like

Posted 22 November 2013 - 03:49 PM

Ahh, perfect!

 

Thanks mate.






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.