need help using glColorPointer

Started by
3 comments, last by Enigma 19 years, 6 months ago
Hello! A read in the Opengl reference,that the glColorPointer accept only 3 or 4 as number of components. My problem is that, when I render my terrain, I only use the alpha value (for multitectuxing). Pixel shaders compute the shadows, so the glColor is (1.0,1.0,1.0,alpha value). So, with vertex object I allocate 4*n byte for storing n important information. Can I store only the alpha values with glColorPointer somehow? Thanks!
Advertisement
If you're using shaders you probably want to use glVertexAttribPointerARB instead.

Enigma
Thanks.
I will try it!

Oh! I almost forgotten.
If I use this method, it will store my array in the GPU memory as it does using Vertex buffer object?

Thanks.
Yes, your data will be stored in the same way as if you had used glColorPointer. glVertexAttribPointerARB was introduced with shaders because per-vertex data was no longer precisely defined to the existing set of data. For example tangents and binormals are often send as texture coordinates for bump-mapping, despite the fact that they are not texture coordinates. Vertex Attributes are a generalisation of a per-vertex data stream specifying that this is per-vertex data of unspecified usage. Check out the ARB vertex program specification for more details.

Enigma

This topic is closed to new replies.

Advertisement