PDA

View Full Version : Chinging color of some vertices in a mesh.



boulbo
04-25-2014, 10:10 AM
Hello,
I am working with opengl 3.1+GLSL 1.4 on ubuntu.
I am developing an application to display 3D meshes in order to some processing on it.
Till now I can display the mesh using Assimp library.
My question is : How can i change the color of some vertex?
Knowing that the set of points to change color is variable (the number and position is not fixed),
I load them from a file.

Any help is appreciated.
thank you.

tonyo_au
04-26-2014, 05:30 PM
There is no quick way to do this. One options is to keep the colour component of all vertices in a separate buffer and reload that buffer with the set of colours each draw. Another is to build an index buffer of vertices for each colour you need to render and set a uniform for the colour

boulbo
04-27-2014, 12:55 AM
Thank you tonyo_au.
The first method looks more simple. But i guess it is RAM consuming since the color change will be done on CPU. Thats why i think that the second method is more sophisticated.