Using Glvertexattribpointer And Gldrawelements To Draw From A Packed Vertex Buffer
I have a packed vertex buffer containing postion coordinates aswell as color values for a vertex in the format {X, Y, Z, R, G, B, A}. I am able to display the rectangle properly wi
Solution 1:
Fragment shaders don't use attributes. Attributes are per-vertex values, which a fragment shader wouldn't know anything about. What you want to do is to take the color as an attribute
to the vertex shader, and then use a varying
to pass the color to the fragment shader.
Also please start using error checking for your shaders, it will tell you when you make mistakes like this:
http://www.khronos.org/opengles/sdk/docs/man/xhtml/glGetProgramiv.xml (check for GL_LINK_STATUS
)
http://www.khronos.org/opengles/sdk/docs/man/xhtml/glGetShaderiv.xml (check for GL_COMPILE_STATUS
)
http://www.khronos.org/opengles/sdk/docs/man/xhtml/glGetProgramInfoLog.xml
http://www.khronos.org/opengles/sdk/docs/man/xhtml/glGetShaderInfoLog.xml
Post a Comment for "Using Glvertexattribpointer And Gldrawelements To Draw From A Packed Vertex Buffer"