i’m currently working on some Cuda-GL-Interop stuff, and got to a point where i’m kind of stuck. This is pretty much the first thing i do with openGL btw, so stupidities might occur on my side.
Basically what i try to do is draw a large amount of single-color cubes. I update the colors and add and remove a few cubes every frame via Cuda, thus i would like to store vertices and colors in VBOs in the gpu memory.
However, i haven’t been able so far to find a way to draw the 8 vertices of a cube with e.g. glDrawRangeElements() while using the same color from the color buffer for all of them. So what i lack is a way to go to the next entry in the color buffer only after every 8th quad draw call that happens in the glDrawRangeElements …
I could obviously insert 1 color value into my color buffer for every vertex, but that would just be a lot of wasted memory.
Is there a way to do this i’ve overlooked? Or is maybe the performance hit so small that i better just put the colors into a normal array, copy it back to the host memory and set the color manually before drawing each cube?
Thanks a lot in advance for any replies