Search code examples
openglgridshadercubepoints

Cheapest method to draw a Grid of 3D Points inside a Cube with OpenGL


I'm looking for the cheapest way to draw a grid of 3D points in OpenGL (e.g. 256x256x256 --> 16.000.000 points) . Currently I store my vertices inside a VBO and pass it to my vertex shader. Is there a better way of storing all of those values inside a giant 1D array, since they should lie on a regular grid?


Solution

  • I think the best way is to store all values in a vector and use VBO to render them.

    The advantage of using vectors is that they have enough space to store as many floats as you want, and it is very easy to manipulate individual points whenever you want. Memory is also not a problem when using vectors.

    VBO was also a good choice, since the data is stored on the graphics card and not on your memory card, giving you more performance.