MicBosi / VisualizationLibrary

Visualization Library is a C++ middleware for high-performance 2D and 3D graphics applications based on OpenGL 1.x-4.x supporting Windows, Linux and Mac OS X.
http://VisualizationLibrary.org
Other
342 stars 96 forks source link

Coloring faces #195

Closed Anastasiia-Iusupova-hub closed 3 years ago

Anastasiia-Iusupova-hub commented 3 years ago

Hi there!

Is there any option to color face? As far as I understand, it's possible to use "setColorArray" for primitive, however I don't understand the workflow for that task. Could you please provide some example?

MicBosi commented 3 years ago

@Anastasiia-Iusupova-hub VL follows OpenGL usual practices. In order to color a face you need to specify the color for each vertex using the color array. Depending on the topology of your geometry and type of primitive some vertices might be shared with more than one polygon. In that case if you want for such polygons to have separate colors they'll need to have separate vertices, which means you might need to duplicate some of them.