VBO vertices colors using shaders

I am displaying a geometry (file format: .stl) with OpenGL (PyOpenGL and Python). Geometry data has the formand is assembled from triangles. I save to VBO data of; vertices, normals and colors. As the normal is only defined per 3 vertices (triangle) and I define color vector for every vertex, the data in VBO has the form:

VBO = [v1x, v1y, v1z,...vNx, vNy, vNz,
          n1x, n1y, n1z,...nNx, nNy, nNz,
          R1, G1, B1,...RN, GN, BN]

In words; first I save all vertices, then I “append” (use of glBufferSubData) all normals (number of normals is 3-times less then number of vertices and vertice’s colors) and then I append color vectors of each vertex. I would like to know if this is good idea, as I have problems painting each vertex in different color. The code for drawing is:

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, self.vbo_id)     
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0) # reset

I think I am having problems with glColorPointer(). Can someone point out the problem? I have also seen two more ways to save the data to VBO:
[li]create separate VBO for vertices, VBO for normals and VBO for colors[/li][li]one VBO but has the form: [v1, c1, v2, c2, v3, c3, n1, …][/li][/ol]
Is any of this two a better solution (more common in practice)? And do I have to assign a normal of triangle to each vertex although it is the same (for 3 vertices that define a triangle)? As I would like to get the display as shown below (left: current state, middle: plan, right: ideal - the point is the shading of surfaces), I would like to ask you to give me some directions about how to achieve this (using shaders).

As far as I know you will get better caching if the 3 components (vertex,colour,normal) are kept together in the buffer. The main reason for splitting the normal away would be if your default render only uses the vertex and colour and occasionally you need all three.

Thanks for reply. I am planing to use interleaved VBOs (vertex, normal, color) and hope this will work for me. Just one thing; if I use interleaved VBOs (vertex, normal, color) I can achive painting each vertex with different color and avoiding using shaders if I understand correctly?
Thanks again!

I have not used VBOs without shaders but I think it should work.

Thanks for the answer. :slight_smile: