I have some code that I'm trying to get working that can draw a
sequence (strip or fan) of triangles from the same data structure. I
have a color struct that is a simple {r,g,b,a} struct (GLubyte
elements).
If I draw a triangle that has a red, blue and green corner
(GL_SMOOTH) with my normal code, I do something like:
unsigned int vertexIndex;
glBegin(sequence->type);
for (vertexIndex = 0; vertexIndex <
sequence->vertexCount; vertexIndex++) {
glColor4ubv((const GLubyte
*)&sequence->vertexColors[vertexIndex]);
glVertex3fv((const GLfloat
*)&sequence->vertexPositions[vertexIndex]);
}
glEnd();
Note that I use 'glColor4ubv'. Blending is OFF though, so the
alpha component should presumably be ignored. I suppose I should
call glColor3ubv in this case, but the code above produces the
expected results.
When I try with vertex arrays, I do something like the following
(dropping a bunch of the other cleanup code):
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(3, GL_UNSIGNED_BYTE, 4,
sequence->vertexColors);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, sequence->vertexPositions);
glDrawArrays(sequence->type, 0, sequence->vertexCount);
This code works too, but notice that I'm only passing three color
components and striding by 4. If I do the following:
glColorPointer(4, GL_UNSIGNED_BYTE, 4,
sequence->vertexColors);
I don't get the expected results (instead, one corner is blue and
the other two are black).
Other info about my configuration:
MacOS X Server, PowerPC (big endian)
Using 3Dfx driver
Mesa 3.1 beta -- current off the head of the repository as
of Sat 10/10/1999.
I'd be interested in hearing if anyone else can replicate this
problem since I'm not exactly using the most standard version of Mesa
:)
Thanks!
-tim
_______________________________________________
Mesa-bug maillist - [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-bug
_______________________________________________
Mesa-dev maillist - [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev