Drawing a cube for each vertex

ぃ、小莉子 提交于 2019-12-25 00:48:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!