From 4aa01e073edee5dcaa172e35a8ce882889b119e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 21 Oct 2012 23:08:19 +0200 Subject: [PATCH] Code cleanup, doc++ --- src/AbstractShaderProgram.h | 4 ++++ src/Buffer.h | 7 +++++++ src/Context.cpp | 2 +- src/Implementation/TextureState.h | 2 -- src/MeshTools/CompressIndices.h | 4 ++-- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/AbstractShaderProgram.h b/src/AbstractShaderProgram.h index bd0cdfaf9..5ec2aad47 100644 --- a/src/AbstractShaderProgram.h +++ b/src/AbstractShaderProgram.h @@ -95,6 +95,7 @@ MyShader* setProjection(const Matrix4& matrix) { @endcode @subsection AbstractShaderProgram-attribute-location Binding attribute location + The preferred workflow is to specify attribute location for vertex shader input attributes and fragment shader output attributes explicitly in the shader code, e.g.: @@ -142,6 +143,7 @@ bindFragmentDataLocationIndexed(1, 1, "ambient"); @endcode @subsection AbstractShaderProgram-uniform-location Uniform locations + The preferred workflow is to specify uniform locations directly in the shader code, e.g.: @code @@ -162,6 +164,7 @@ GLint projectionUniform = uniformLocation("projection"); @endcode @subsection AbstractShaderProgram-texture-layer Binding texture layer uniforms + The preferred workflow is to specify texture layers directly in the shader code, e.g.: @code @@ -202,6 +205,7 @@ mesh.draw(); @endcode @section AbstractShaderProgram-performance-optimization Performance optimizations + The engine tracks currently used shader program to avoid unnecessary calls to @fn_gl{UseProgram}. diff --git a/src/Buffer.h b/src/Buffer.h index 17f69a52d..93ff82dd9 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -38,6 +38,7 @@ Encapsulates one OpenGL buffer object and provides functions for convenient data updates. @section Buffer-data Data updating + Default way to set or update buffer data with setData() or setSubData() is to explicitly specify data size and pass the pointer to it: @code @@ -61,6 +62,7 @@ buffer.setData(data, Buffer::Usage::StaticDraw); @endcode @section Buffer-performance-optimization Performance optimizations + The engine tracks currently bound buffers to avoid unnecessary calls to @fn_gl{BindBuffer}. If the buffer is already bound to some target, functions copy(), setData() and setSubData() use that target in @@ -307,6 +309,9 @@ class MAGNUM_EXPORT Buffer { * * Default target hint is `Target::Array`. * @see setData(), setSubData() + * @todo Target::ElementArray cannot be used when no VAO is bound - + * http://www.opengl.org/wiki/Vertex_Specification#Index_buffers + * ... damned GL state */ inline void setTargetHint(Target hint) { _targetHint = hint; } @@ -314,6 +319,8 @@ class MAGNUM_EXPORT Buffer { * @brief Bind buffer * @param target %Target * + * @todo Allow binding to Target::ElementArray only if VAO is bound + * to avoid potential issues? * @see @fn_gl{BindBuffer} */ inline void bind(Target target) { bind(target, _id); } diff --git a/src/Context.cpp b/src/Context.cpp index a4473c665..06cfe594f 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -22,11 +22,11 @@ #include "AbstractShaderProgram.h" #include "AbstractTexture.h" #include "Buffer.h" +#include "BufferedTexture.h" #include "Extensions.h" #include "IndexedMesh.h" #include "Mesh.h" #include "Implementation/State.h" -#include "BufferedTexture.h" using namespace std; diff --git a/src/Implementation/TextureState.h b/src/Implementation/TextureState.h index 74388443e..73eca32af 100644 --- a/src/Implementation/TextureState.h +++ b/src/Implementation/TextureState.h @@ -17,8 +17,6 @@ #include "Magnum.h" -#include "Buffer.h" - namespace Magnum { namespace Implementation { struct TextureState { diff --git a/src/MeshTools/CompressIndices.h b/src/MeshTools/CompressIndices.h index d86dc154c..ec6c88fb5 100644 --- a/src/MeshTools/CompressIndices.h +++ b/src/MeshTools/CompressIndices.h @@ -90,8 +90,8 @@ inline std::tuple compressIndices(const std::vector&), but this function writes the output to mesh's index buffer and updates index count and -type in the mesh accordingly, so you don't have to call Mesh::setIndexCount() -and Mesh::setIndexType() on your own. +type in the mesh accordingly, so you don't have to call +IndexedMesh::setIndexCount() and IndexedMesh::setIndexType() on your own. @see MeshTools::interleave() */