问题
I have a list of 3D vertices which I can easily render as a pointcloud by passing the whole list to my vertex shader, setting gl_Position = pos
, then setting FragColor = vec4(1.0, 1.0, 1.0, 1.0)
and use GL_POINTS
in the drawing function.
I would now like to render an actual cube at that vertex position, with the vertex being the center of the cube and some given width. How can I achieve this in the most easy and performant way? Looping through all vertices, loading a cube into a buffer and then passing the vertex position to the vertex shader to draw each cube individually does not seem to be feasible to me, or is that the way to go?
来源:https://stackoverflow.com/questions/59406663/drawing-a-cube-for-each-vertex