Original Post
I've been having problems using vertex programs with vertex arrays on my machine.
This produces the correct image on my screen
void drawNormal() {
glBegin( GL_TRIANGLE_STRIP );
for( int i = 0; i < kNumPoints; i++ ) {
glVertexAttrib3fvARB( 2, gColors + 3 * ( kNumPoints + i ) );
glVertexAttrib3fvARB( 1, gColors + 3 * i );
glVertexAttrib3fvARB( 0, gPoints + 3 * i );
}
glEnd();
}
This code (which if I read the spec properly is equivalent), however produces the dreaded black screen
void drawVA() {
glEnableVertexAttribArrayARB( 0 );
glEnableVertexAttribArrayARB( 1 );
glEnableVertexAttribArrayARB( 2 );
glVertexAttribPointerARB( 0, 3, GL_FLOAT, false, 0, gPoints );
glVertexAttribPointerARB( 1, 3, GL_FLOAT, false, 0, gColors );
glVertexAttribPointerARB( 2, 3, GL_FLOAT, false, 0, gColors + 3 * kNumPoints );
glBegin( GL_TRIANGLE_STRIP );
for( int i = 0; i < kNumPoints; i++ ) {
glArrayElement( i );
}
glEnd();
glDisableVertexAttribArrayARB( 0 );
glDisableVertexAttribArrayARB( 1 );
glDisableVertexAttribArrayARB( 2 );
}
The vertex program does colour morphing according to the vertex attributes 1 & 2 and a program enironment parameter (elsewhere)
First, am I right in thinking these bits of code are equialent? And if so any idea what else could be going wrong? If not what am I missing?
I've reduced it to a test program that draws a single square and swaps between the two modes at the push of a button if that will help.
[edited by - pjstirling on May 11, 2004 4:22:17 PM]