From: Mikko Rasa Date: Wed, 22 Aug 2012 13:08:50 +0000 (+0300) Subject: Add definitions for the GL_ARB_uniform_buffer_object extension X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=5f8bc38419379b7d47aa69cb68d380728f5ee26f;p=libs%2Fgl.git Add definitions for the GL_ARB_uniform_buffer_object extension --- diff --git a/source/arb_uniform_buffer_object.cpp b/source/arb_uniform_buffer_object.cpp new file mode 100644 index 00000000..5de8da78 --- /dev/null +++ b/source/arb_uniform_buffer_object.cpp @@ -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(get_proc_address("glGetUniformIndices")); + glGetActiveUniformsiv = reinterpret_cast(get_proc_address("glGetActiveUniformsiv")); + glGetActiveUniformName = reinterpret_cast(get_proc_address("glGetActiveUniformName")); + glGetUniformBlockIndex = reinterpret_cast(get_proc_address("glGetUniformBlockIndex")); + glGetActiveUniformBlockiv = reinterpret_cast(get_proc_address("glGetActiveUniformBlockiv")); + glGetActiveUniformBlockName = reinterpret_cast(get_proc_address("glGetActiveUniformBlockName")); + glUniformBlockBinding = reinterpret_cast(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 index 00000000..e53b1f29 --- /dev/null +++ b/source/arb_uniform_buffer_object.h @@ -0,0 +1,23 @@ +#ifndef MSP_GL_ARB_UNIFORM_BUFFER_OBJECT_ +#define MSP_GL_ARB_UNIFORM_BUFFER_OBJECT_ + +#include "gl.h" +#include + +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 diff --git a/source/extension.cpp b/source/extension.cpp index ef05e39b..c846c59d 100644 --- a/source/extension.cpp +++ b/source/extension.cpp @@ -6,6 +6,7 @@ #include #include #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; }