diff --git a/modules/globebrowsing/meshes/trianglesoup.cpp b/modules/globebrowsing/meshes/trianglesoup.cpp index adfbad88e8..83aa715a83 100644 --- a/modules/globebrowsing/meshes/trianglesoup.cpp +++ b/modules/globebrowsing/meshes/trianglesoup.cpp @@ -49,7 +49,6 @@ TriangleSoup::~TriangleSoup() { glDeleteVertexArrays(1, &_vaoID); } - void TriangleSoup::setVertexPositions(std::vector positions) { _useVertexPositions = true; _gpuDataNeedUpdate = true; @@ -63,7 +62,6 @@ void TriangleSoup::setVertexPositions(std::vector positions) { } } - void TriangleSoup::setVertexTextureCoordinates(std::vector textures) { _useTextureCoordinates = true; _gpuDataNeedUpdate = true; @@ -75,7 +73,6 @@ void TriangleSoup::setVertexTextureCoordinates(std::vector textures) } } - void TriangleSoup::setVertexNormals(std::vector normals) { _useVertexNormals = true; _gpuDataNeedUpdate = true; @@ -88,7 +85,6 @@ void TriangleSoup::setVertexNormals(std::vector normals) { } } - void TriangleSoup::setElements(std::vector elements) { _elementData.resize(elements.size()); _gpuDataNeedUpdate = true; @@ -98,7 +94,7 @@ void TriangleSoup::setElements(std::vector elements) { } } -bool TriangleSoup::updateDataInGPU() { +bool TriangleSoup::updateDataOnGPU() { // Create VAO if (_vaoID == 0) glGenVertexArrays(1, &_vaoID); @@ -119,7 +115,6 @@ bool TriangleSoup::updateDataInGPU() { } } - // First VAO setup glBindVertexArray(_vaoID); @@ -167,7 +162,7 @@ bool TriangleSoup::updateDataInGPU() { void TriangleSoup::drawUsingActiveProgram() { if (_gpuDataNeedUpdate) { - updateDataInGPU(); + updateDataOnGPU(); } glBindVertexArray(_vaoID); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _elementBufferID); diff --git a/modules/globebrowsing/meshes/trianglesoup.h b/modules/globebrowsing/meshes/trianglesoup.h index d2291e8a66..c8aeeb7bda 100644 --- a/modules/globebrowsing/meshes/trianglesoup.h +++ b/modules/globebrowsing/meshes/trianglesoup.h @@ -35,15 +35,14 @@ namespace openspace { /** - Class to hold vertex data and handling OpenGL interfacing and rendering. A Geometry - has all data needed such as position buffer and normal buffer but all data is not - necessarily needed for all purpouses so the Geometry can disable use of normals for - example. +* Class to hold vertex data and handling OpenGL interfacing and rendering. +* A TriangleSoup has all data needed such as position buffer and normal +* buffer but all data is not necessarily needed for all purpouses so some vertex buffers +* such as normals can be disabled if not needed. */ - // TODO : Possibly render triangle strips in this class instead of triangles since - // that is faster - +// TODO : Possibly render triangle strips in this class instead of triangles since +// that is faster class TriangleSoup { public: @@ -64,8 +63,14 @@ public: void setVertexNormals(std::vector normals); void setElements(std::vector elements); - - + /** + * Calls OpenGL's draw function to draw the triangles defined in the vertex buffers + * using the current bound program object. + * The vertex buffer attribute input locations to the shader program comes in the + * order of positions (0), texture coordinates (1) and normals (2). + * The input locations in the shader program should be specified to match these + * locations. + */ void drawUsingActiveProgram(); protected: @@ -88,7 +93,7 @@ protected: std::vector _elementData; private: - bool updateDataInGPU(); + bool updateDataOnGPU(); // GL handles GLuint _vaoID;