Use VBO to define color & vertex variable in GPU

I added this to the initialization part:

verticesSize = sizeof(vertices);
colorsSize   = sizeof(colors);

glGenBuffers(2, vbods);                       

glBindBuffer(GL_ARRAY_BUFFER, vbods[VERTEX]); 

glBufferData(GL_ARRAY_BUFFER,
             sizeof(vertices)+sizeof(colors),
             vertices, GL_STATIC_DRAW );

glBufferSubData(GL_ARRAY_BUFFER, sizeof(vertices), sizeof(colors), colors);

glEnableClientState(GL_VERTEX_ARRAY); 
glEnableClientState(GL_COLOR_ARRAY); 

and this to the render part:

glBindBuffer(GL_ARRAY_BUFFER, vbods[VERTEX]);
glVertexPointer(2, QVector3D, 0, 0);   
glColorPointer(3, GL_FLOAT, 0, (GLvoid *) (ANGLE_COUNT * RANGE_COUNT * 6)); 

though, I get errors in the functions glBufferData, It cannot cast it from QVector3D to GLvoid*, do you have any idea?

vertices is defined as

QVector<QVector3D>

vertices.constData
solved the problem

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.