Jump to content
  • Advertisement
Sign in to follow this  

Vertex Attributes in GLSL

This topic is 3659 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I learned from http://www.gamedev.net/community/forums/topic.asp?topic_id=448107 that an attribute must be used, otherwise glGetAttribLocation() will return -1. I'm trying to make a normal mapping shader, so I'm passing in a vector as an attribute ("vert_tangent"), and trying to send it to the fragment shader (via "blah", for proof of concept). However, as mentioned in the first paragraph, glGetAttribLocation() returns -1 when I try to do this:
varying vec3 blah;
attribute vec3 vert_tangent;
void main()
    //This line lets glGetAttribLocation() return 1.
    gl_Vertex.xyz *= vert_tangent;

    //This line makes glGetAttribLocation() return -1.  WHY???
    blah.xyz = vert_tangent;
Thanks, -G

Share this post

Link to post
Share on other sites
Do you have a fragment shader that is actually consuming the varying 'blah' ? If not, it will be optimized away. That fragment shader must be linked together with your vertex shader, and it must make use of the varying.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!