Jump to content

  • Log In with Google      Sign In   
  • Create Account


APi inconsistencies


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
1 reply to this topic

#1 caibbor   Members   -  Reputation: 116

Like
0Likes
Like

Posted 30 December 2012 - 03:53 AM

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);

 

http://www.opengl.org/sdk/docs/man/xhtml/glEnableVertexAttribArray.xml
http://www.opengl.org/sdk/docs/man/xhtml/glGetAttribLocation.xml

so I ask... "wtf?"

 

am I overlooking something important?


Edited by caibbor, 30 December 2012 - 03:54 AM.


Sponsor:

#2 haegarr   Crossbones+   -  Reputation: 3736

Like
2Likes
Like

Posted 30 December 2012 - 04:20 AM

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, 30 December 2012 - 04:22 AM.





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.



PARTNERS