Jump to content


glVertexAttribPointer


4 replies to this topic

#1 tobeythorn

    Valued Member

  • Members
  • PipPipPip
  • 189 posts

Posted 19 March 2009 - 12:12 AM

Hi,
I've recently learned that in openGL, glVertexPointer, glNormalPointer, etc, are set for deprecation. The new way of doing things seems to be glVertexAttribPointer. However, I haven't found any examples of its use. From what I understand, it passes attribute variables to the shaders program. Not really sure how to name those variables so that I can use them in my shader.

Have any of you used this yet? Any examples?
Thanks,
-Tobey

#2 Reedbeta

    DevMaster Staff

  • Administrators
  • 4969 posts
  • LocationBellevue, WA

Posted 19 March 2009 - 12:53 AM

Shading languages like Cg allow you to use semantics like ATTR0, ATTR1 (not 100% sure about the spelling of those), in place of the usual POSITION, NORMAL, TEXCOORD0 and so forth. You can specify the data for these semantics with glVertexAttribPointer. I don't remember how you do this in GLSL, but I assume it has some similar function.
reedbeta.com - developer blog, OpenGL demos, and other projects

#3 delinkx

    New Member

  • Members
  • PipPip
  • 24 posts

Posted 19 March 2009 - 04:12 AM

http://www.opengl.or...tribPointer.xml
............................
delinkx.com/blog
portfolio.delinkx.com
hostfields.com

#4 tobeythorn

    Valued Member

  • Members
  • PipPipPip
  • 189 posts

Posted 19 March 2009 - 02:14 PM

delinkx,
Yes, that is the only document I have found at all, and it makes more sense the second time around. However, it doesn't provide an example of its use, and I still have no idea how to access the attributes in my vertex shader. I would like to specify both vertex positions and normals, and possibly other arrayed attributes too.

#5 tobeythorn

    Valued Member

  • Members
  • PipPipPip
  • 189 posts

Posted 19 March 2009 - 02:16 PM

Nevermind, I believe that the following function does what I want:
GLint glGetAttribLocation(GLuint program,char *name);





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users