Commit 3819f1c5 authored by Robert Menzel's avatar Robert Menzel

documentation and cleanup

parent e6c41482
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#ifndef ACGL_OPENGL_OBJECTS_LOCATIONMAPPINGS_HH #ifndef ACGL_OPENGL_OBJECTS_LOCATIONMAPPINGS_HH
#define ACGL_OPENGL_OBJECTS_LOCATIONMAPPINGS_HH #define ACGL_OPENGL_OBJECTS_LOCATIONMAPPINGS_HH
/* /**
* LocationMappings is a map from strings to GLuints that stores the mappings from * LocationMappings is a map from strings to GLuints that stores the mappings from
* *
* attribute names to attribute locations * attribute names to attribute locations
...@@ -15,8 +15,11 @@ ...@@ -15,8 +15,11 @@
* *
* (as long as there are no name clashes one map can be used for both) * (as long as there are no name clashes one map can be used for both)
* *
* A mapping like this can be used to init all mappings of multiple ShaderProgram * Another use is to query
* in the same way to they can be used with the same VAOs or FBOs, similar, these * uniform names to uniform buffer offsets
*
* A mapping like this can be used to init all mappings of multiple ShaderPrograms
* in the same way to they can be used with the same VAOs or FBOs. Similar, these
* mapping objects can be used to configute VAOs and FBOs! * mapping objects can be used to configute VAOs and FBOs!
* *
* To fully automate the mappings in a program the creation of these mappings can * To fully automate the mappings in a program the creation of these mappings can
......
...@@ -14,11 +14,13 @@ ...@@ -14,11 +14,13 @@
#include <ACGL/OpenGL/Objects/ShaderProgram.hh> #include <ACGL/OpenGL/Objects/ShaderProgram.hh>
#if (ACGL_OPENGL_VERSION >= 41)
namespace ACGL{ namespace ACGL{
namespace OpenGL{ namespace OpenGL{
/** /**
* OpenGL ProgramPipeline Objects * OpenGL ProgramPipeline Objects (needs OpenGL 4.1)
* *
* Multiple ShaderPrograms that are set to be separable can be attached to one ProgramPipeline. * Multiple ShaderPrograms that are set to be separable can be attached to one ProgramPipeline.
* Uniforms are still a ShaderProgram (not ProgramPipeline) state, so to update them you either have to * Uniforms are still a ShaderProgram (not ProgramPipeline) state, so to update them you either have to
...@@ -29,8 +31,6 @@ namespace OpenGL{ ...@@ -29,8 +31,6 @@ namespace OpenGL{
* play around with ProgramPipeline Objects. * play around with ProgramPipeline Objects.
*/ */
#if (ACGL_OPENGL_VERSION >= 41)
class ProgramPipeline { class ProgramPipeline {
ACGL_NOT_COPYABLE(ProgramPipeline) ACGL_NOT_COPYABLE(ProgramPipeline)
public: public:
...@@ -80,9 +80,10 @@ private: ...@@ -80,9 +80,10 @@ private:
}; };
ACGL_SMARTPOINTER_TYPEDEFS(ProgramPipeline) ACGL_SMARTPOINTER_TYPEDEFS(ProgramPipeline)
#endif // OpenGL >= 4.1
} // OpenGL } // OpenGL
} // ACGL } // ACGL
#endif // OpenGL >= 4.1
#endif // ACGL_OPENGL_OBJECTS_PROGRAMPIPELINE_HH #endif // ACGL_OPENGL_OBJECTS_PROGRAMPIPELINE_HH
...@@ -14,14 +14,27 @@ ...@@ -14,14 +14,27 @@
#include <ACGL/Math/Math.hh> #include <ACGL/Math/Math.hh>
#if (ACGL_OPENGL_VERSION >= 33)
namespace ACGL{ namespace ACGL{
namespace OpenGL{ namespace OpenGL{
/* /*
* OpenGL Sampler Objects * OpenGL Sampler Objects (needs OpenGL 3.3)
*
* A Sampler holds information about how to sample in textures (bi-linear, anisotrophic, wrap modes etc).
* Instead of setting these informations for each texture, a sampler object can be used and bound to
* the texture units, this will overwrite the sampling information in the texture object itself.
* This way, one texture can be bound to two texture units and two different samplers can be bound to those
* units to provide different sampling behavior from the same texture in one shaderpass.
* Similar, different textures can use the same sampler so only one object has to be changed if for example
* the number of anisotrophic filter-samples should get changed (instead of changing all texture objects).
*
* All default parameters of the setters used to change the sampling behavior are the OpenGL defaults as well.
*
* If needed, getters could be added that query the settings from GL, so no caching is needed here (that might
* be something for a derived class with larger memory footprint but faster access to the settings).
*/ */
#if (ACGL_OPENGL_VERSION >= 33)
class Sampler { class Sampler {
ACGL_NOT_COPYABLE(Sampler) ACGL_NOT_COPYABLE(Sampler)
...@@ -82,9 +95,10 @@ private: ...@@ -82,9 +95,10 @@ private:
}; };
ACGL_SMARTPOINTER_TYPEDEFS(Sampler) ACGL_SMARTPOINTER_TYPEDEFS(Sampler)
#endif // OpenGL >= 3.3
} // OpenGL } // OpenGL
} // ACGL } // ACGL
#endif // OpenGL >= 3.3
#endif // ACGL_OPENGL_OBJECTS_SAMPLER_HH #endif // ACGL_OPENGL_OBJECTS_SAMPLER_HH
...@@ -6,6 +6,25 @@ ...@@ -6,6 +6,25 @@
#ifndef ACGL_OPENGL_OBJECTS_UNIFORM_BUFFER_HH #ifndef ACGL_OPENGL_OBJECTS_UNIFORM_BUFFER_HH
#define ACGL_OPENGL_OBJECTS_UNIFORM_BUFFER_HH #define ACGL_OPENGL_OBJECTS_UNIFORM_BUFFER_HH
/*
* A uniform buffer is an OpenGL buffer object bound to a uniform buffer location.
* It can be used:
* provide the same set of uniforms to different ShaderPrograms without setting
the values multiple times
* set multiple uniform variables at once by mapping the buffer into the CPU
memory, memset all values and unmap it.
*
* To be used, uniforms must be organized in a uniform block, this block has to be bound
* to the same location the uniform buffer gets bound to (quite similar to textures).
*
* If only advantage one is requested, the individual offsets along with the uniform names
* can be saved in a uniform buffer to set the uniforms by setUniform() as it would be done
* for normal uniforms in a ShaderProgram.
* Otherwise the exact memory layout must be known, which can be queried by OpenGL, but which
* is also well defined in the case of std140-blocks (see OpenGL spec).
*
*/
#include <ACGL/ACGL.hh> #include <ACGL/ACGL.hh>
#include <ACGL/Base/Macros.hh> #include <ACGL/Base/Macros.hh>
...@@ -16,6 +35,7 @@ ...@@ -16,6 +35,7 @@
#include <ACGL/OpenGL/Objects/LocationMappings.hh> #include <ACGL/OpenGL/Objects/LocationMappings.hh>
#include <ACGL/Math/Math.hh> #include <ACGL/Math/Math.hh>
#if (ACGL_OPENGL_VERSION >= 31)
namespace ACGL{ namespace ACGL{
namespace OpenGL{ namespace OpenGL{
...@@ -23,8 +43,6 @@ namespace OpenGL{ ...@@ -23,8 +43,6 @@ namespace OpenGL{
* An OpenGL Uniform Buffer Object that can be used to share blocks of uniforms between multiple ShaderPrograms. * An OpenGL Uniform Buffer Object that can be used to share blocks of uniforms between multiple ShaderPrograms.
*/ */
#if (ACGL_OPENGL_VERSION >= 31)
class UniformBuffer : public Buffer class UniformBuffer : public Buffer
{ {
// ========================================================================================================= \/ // ========================================================================================================= \/
...@@ -93,9 +111,10 @@ private: ...@@ -93,9 +111,10 @@ private:
}; };
ACGL_SMARTPOINTER_TYPEDEFS(UniformBuffer) ACGL_SMARTPOINTER_TYPEDEFS(UniformBuffer)
#endif // OpenGL >= 3.1
} // OpenGL } // OpenGL
} // ACGL } // ACGL
#endif // OpenGL >= 3.1
#endif // ACGL_OPENGL_OBJECTS_UNIFORM_BUFFER_HH #endif // ACGL_OPENGL_OBJECTS_UNIFORM_BUFFER_HH
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment