Hi all,
i worked a lot with shaders, but only used VBO.
Now i have a APP where i need to draw from Vertex Array.
So here is my render func, i can´t get it working:
void RenderFunction(void)
{
++FrameCount;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// draw from VBO <<<<<<<<< worx fine
CreateVBO();
glDrawArrays(GL_LINE_LOOP, 0, 3);
// draw from Vertex array <<<<<<< does not draw anything
GLfloat vVertices[] = { 0.0f, 0.5f, 0.0f, 1.0f,
-0.5f, -0.5f, 0.0f, 1.0f,
0.5f, -0.5f, 0.0f, 1.0f };
GLfloat colors[] = { 0.0f, 0.5f, 0.0f, 1.0f,
0.5f, 0.5f, 0.0f, 1.0f,
0.5f, 0.5f, 1.0f, 1.0f };
// Load the vertex data
glVertexAttribPointer ( 0, 4, GL_FLOAT, GL_FALSE, 0, vVertices );
glVertexAttribPointer ( 1, 4, GL_FLOAT, GL_FALSE, 0, colors );
glEnableVertexAttribArray ( 0 );
glEnableVertexAttribArray ( 1 );
glDrawArrays ( GL_LINE_LOOP, 0, 3 );
glDisableVertexAttribArray ( 0 );
glDisableVertexAttribArray ( 1 );
glutSwapBuffers();
glutPostRedisplay();
}
can someone pls tell me where i got my missunderstanding ?
The shader programm is loaded and succesfully used bei the VBO drawing.
Also the attributs in the shader are binded to 0 and 1 - as well used for the VBO.
I also checked the coordinates - they are fine as well.
what do i need to change ?
thanx
uwi