]> git.tdb.fi Git - libs/gl.git/commitdiff
Add definitions for the GL_ARB_uniform_buffer_object extension
authorMikko Rasa <tdb@tdb.fi>
Wed, 22 Aug 2012 13:08:50 +0000 (16:08 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 22 Aug 2012 13:08:50 +0000 (16:08 +0300)
source/arb_uniform_buffer_object.cpp [new file with mode: 0644]
source/arb_uniform_buffer_object.h [new file with mode: 0644]
source/extension.cpp

diff --git a/source/arb_uniform_buffer_object.cpp b/source/arb_uniform_buffer_object.cpp
new file mode 100644 (file)
index 0000000..5de8da7
--- /dev/null
@@ -0,0 +1,27 @@
+#include "extension.h"
+#include "arb_uniform_buffer_object.h"
+
+namespace Msp {
+namespace GL {
+
+PFNGLGETUNIFORMINDICESPROC glGetUniformIndices = 0;
+PFNGLGETACTIVEUNIFORMSIVPROC glGetActiveUniformsiv = 0;
+PFNGLGETACTIVEUNIFORMNAMEPROC glGetActiveUniformName = 0;
+PFNGLGETUNIFORMBLOCKINDEXPROC glGetUniformBlockIndex = 0;
+PFNGLGETACTIVEUNIFORMBLOCKIVPROC glGetActiveUniformBlockiv = 0;
+PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glGetActiveUniformBlockName = 0;
+PFNGLUNIFORMBLOCKBINDINGPROC glUniformBlockBinding = 0;
+
+void init_arb_uniform_buffer_object()
+{
+       glGetUniformIndices = reinterpret_cast<PFNGLGETUNIFORMINDICESPROC>(get_proc_address("glGetUniformIndices"));
+       glGetActiveUniformsiv = reinterpret_cast<PFNGLGETACTIVEUNIFORMSIVPROC>(get_proc_address("glGetActiveUniformsiv"));
+       glGetActiveUniformName = reinterpret_cast<PFNGLGETACTIVEUNIFORMNAMEPROC>(get_proc_address("glGetActiveUniformName"));
+       glGetUniformBlockIndex = reinterpret_cast<PFNGLGETUNIFORMBLOCKINDEXPROC>(get_proc_address("glGetUniformBlockIndex"));
+       glGetActiveUniformBlockiv = reinterpret_cast<PFNGLGETACTIVEUNIFORMBLOCKIVPROC>(get_proc_address("glGetActiveUniformBlockiv"));
+       glGetActiveUniformBlockName = reinterpret_cast<PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC>(get_proc_address("glGetActiveUniformBlockName"));
+       glUniformBlockBinding = reinterpret_cast<PFNGLUNIFORMBLOCKBINDINGPROC>(get_proc_address("glUniformBlockBinding"));
+}
+
+} // namespace GL
+} // namespace Msp
diff --git a/source/arb_uniform_buffer_object.h b/source/arb_uniform_buffer_object.h
new file mode 100644 (file)
index 0000000..e53b1f2
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef MSP_GL_ARB_UNIFORM_BUFFER_OBJECT_
+#define MSP_GL_ARB_UNIFORM_BUFFER_OBJECT_
+
+#include "gl.h"
+#include <GL/glext.h>
+
+namespace Msp {
+namespace GL {
+
+extern PFNGLGETUNIFORMINDICESPROC glGetUniformIndices;
+extern PFNGLGETACTIVEUNIFORMSIVPROC glGetActiveUniformsiv;
+extern PFNGLGETACTIVEUNIFORMNAMEPROC glGetActiveUniformName;
+extern PFNGLGETUNIFORMBLOCKINDEXPROC glGetUniformBlockIndex;
+extern PFNGLGETACTIVEUNIFORMBLOCKIVPROC glGetActiveUniformBlockiv;
+extern PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glGetActiveUniformBlockName;
+extern PFNGLUNIFORMBLOCKBINDINGPROC glUniformBlockBinding;
+
+void init_arb_uniform_buffer_object();
+
+} // namespace GL
+} // namespace Msp
+
+#endif
index ef05e39bfca79705841ecf4a96ce682a8942a322..c846c59d72398dc0c1cbdbf59d03859871cc3ca2 100644 (file)
@@ -6,6 +6,7 @@
 #include <msp/strings/format.h>
 #include <msp/strings/utils.h>
 #include "arb_shader_objects.h"
+#include "arb_uniform_buffer_object.h"
 #include "arb_vertex_buffer_object.h"
 #include "arb_vertex_program.h"
 #include "arb_vertex_shader.h"
@@ -55,6 +56,8 @@ bool is_supported(const string &ext)
                        init_arb_vertex_buffer_object();
                if(extensions.count("GL_NV_primitive_restart"))
                        init_nv_primitive_restart();
+               if(extensions.count("GL_ARB_uniform_buffer_object"))
+                       init_arb_uniform_buffer_object();
 
                init_done = true;
        }