Jump to content
  • Advertisement
Sign in to follow this  

OpenGL APi inconsistencies

This topic is 2118 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

glEnableVertexAttribArray takes am attribute location value which you get with glGetAttribLocation. however, glGetAttribLocation returns a SIGNED integer, and

glEnableVertexAttribArray takes an UNsigned integer, as shown by ths following links (and this is how it is implemented in glew):

GLint glGetAttribLocation(GLuint  program,  const GLchar * name);
void glEnableVertexAttribArray(GLuint  index);



so I ask... "wtf?"


am I overlooking something important?

Edited by caibbor

Share this post

Link to post
Share on other sites
glGetAttribLocation uses a result of -1 to denote a problem. Cited from one of the links in the OP:

... If the named attribute variable is not an active attribute in the specified program object or if name starts with the reserved prefix "gl_", a value of -1 is returned.
-1 is noticeably different from the "valid" values, and it doesn't make sense to pass such an index into glEnableVertexAttribArray. Doing this requires a signed return type for glGetAttribLocation, but for the glEnableVertexAttribArray index an unsigned parameter type is still appropriate. (Whether this is a solution one is happy with is another question.) Edited by haegarr

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!