X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fext_framebuffer_object.cpp;h=a89b5743e8f423fba67c242a5c60e37ad1b73ff8;hb=a3d248c7db9f04919ed5e4053f6e2a2f776cec47;hp=80da8283befc5561928e8d0262bedffff13b2b1e;hpb=a361efc05fcad11b2918f3cd7abdebe794b131d8;p=libs%2Fgl.git diff --git a/source/ext_framebuffer_object.cpp b/source/ext_framebuffer_object.cpp index 80da8283..a89b5743 100644 --- a/source/ext_framebuffer_object.cpp +++ b/source/ext_framebuffer_object.cpp @@ -1,47 +1,74 @@ -#include "extension.h" #include "ext_framebuffer_object.h" namespace Msp { namespace GL { -PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT=0; -PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT=0; -PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT=0; -PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT=0; -PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT=0; -PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT=0; -PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT=0; -PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT=0; -PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT=0; -PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT=0; -PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT=0; -PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT=0; -PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT=0; -PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT=0; -PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT=0; -PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT=0; -PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT=0; +PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebuffer = 0; +PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbuffer = 0; +PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatus = 0; +PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffers = 0; +PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffers = 0; +PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbuffer = 0; +PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1D = 0; +PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2D = 0; +PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3D = 0; +PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffers = 0; +PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffers = 0; +PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmap = 0; +PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameteriv = 0; +PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameteriv = 0; +PFNGLISFRAMEBUFFEREXTPROC glIsFramebuffer = 0; +PFNGLISRENDERBUFFEREXTPROC glIsRenderbuffer = 0; +PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorage = 0; -void init_ext_framebuffer_object() +Extension::SupportLevel init_ext_framebuffer_object() { - glIsRenderbufferEXT=reinterpret_cast(get_proc_address("glIsRenderbufferEXT")); - glBindRenderbufferEXT=reinterpret_cast(get_proc_address("glBindRenderbufferEXT")); - glDeleteRenderbuffersEXT=reinterpret_cast(get_proc_address("glDeleteRenderbuffersEXT")); - glGenRenderbuffersEXT=reinterpret_cast(get_proc_address("glGenRenderbuffersEXT")); - glRenderbufferStorageEXT=reinterpret_cast(get_proc_address("glRenderbufferStorageEXT")); - glGetRenderbufferParameterivEXT=reinterpret_cast(get_proc_address("glGetRenderbufferParameterivEXT")); - glIsFramebufferEXT=reinterpret_cast(get_proc_address("glIsFramebufferEXT")); - glBindFramebufferEXT=reinterpret_cast(get_proc_address("glBindFramebufferEXT")); - glDeleteFramebuffersEXT=reinterpret_cast(get_proc_address("glDeleteFramebuffersEXT")); - glGenFramebuffersEXT=reinterpret_cast(get_proc_address("glGenFramebuffersEXT")); - glCheckFramebufferStatusEXT=reinterpret_cast(get_proc_address("glCheckFramebufferStatusEXT")); - glFramebufferTexture1DEXT=reinterpret_cast(get_proc_address("glFramebufferTexture1DEXT")); - glFramebufferTexture2DEXT=reinterpret_cast(get_proc_address("glFramebufferTexture2DEXT")); - glFramebufferTexture3DEXT=reinterpret_cast(get_proc_address("glFramebufferTexture3DEXT")); - glFramebufferRenderbufferEXT=reinterpret_cast(get_proc_address("glFramebufferRenderbufferEXT")); - glGetFramebufferAttachmentParameterivEXT=reinterpret_cast(get_proc_address("glGetFramebufferAttachmentParameterivEXT")); - glGenerateMipmapEXT=reinterpret_cast(get_proc_address("glGenerateMipmapEXT")); + if(is_version_at_least(3, 0) || is_supported("GL_ARB_framebuffer_object")) + { + glBindFramebuffer = reinterpret_cast(get_proc_address("glBindFramebuffer")); + glBindRenderbuffer = reinterpret_cast(get_proc_address("glBindRenderbuffer")); + glCheckFramebufferStatus = reinterpret_cast(get_proc_address("glCheckFramebufferStatus")); + glDeleteFramebuffers = reinterpret_cast(get_proc_address("glDeleteFramebuffers")); + glDeleteRenderbuffers = reinterpret_cast(get_proc_address("glDeleteRenderbuffers")); + glFramebufferRenderbuffer = reinterpret_cast(get_proc_address("glFramebufferRenderbuffer")); + glFramebufferTexture1D = reinterpret_cast(get_proc_address("glFramebufferTexture1D")); + glFramebufferTexture2D = reinterpret_cast(get_proc_address("glFramebufferTexture2D")); + glFramebufferTexture3D = reinterpret_cast(get_proc_address("glFramebufferTexture3D")); + glGenFramebuffers = reinterpret_cast(get_proc_address("glGenFramebuffers")); + glGenRenderbuffers = reinterpret_cast(get_proc_address("glGenRenderbuffers")); + glGenerateMipmap = reinterpret_cast(get_proc_address("glGenerateMipmap")); + glGetFramebufferAttachmentParameteriv = reinterpret_cast(get_proc_address("glGetFramebufferAttachmentParameteriv")); + glGetRenderbufferParameteriv = reinterpret_cast(get_proc_address("glGetRenderbufferParameteriv")); + glIsFramebuffer = reinterpret_cast(get_proc_address("glIsFramebuffer")); + glIsRenderbuffer = reinterpret_cast(get_proc_address("glIsRenderbuffer")); + glRenderbufferStorage = reinterpret_cast(get_proc_address("glRenderbufferStorage")); + return Extension::CORE; + } + if(is_supported("GL_EXT_framebuffer_object")) + { + glBindFramebuffer = reinterpret_cast(get_proc_address("glBindFramebufferEXT")); + glBindRenderbuffer = reinterpret_cast(get_proc_address("glBindRenderbufferEXT")); + glCheckFramebufferStatus = reinterpret_cast(get_proc_address("glCheckFramebufferStatusEXT")); + glDeleteFramebuffers = reinterpret_cast(get_proc_address("glDeleteFramebuffersEXT")); + glDeleteRenderbuffers = reinterpret_cast(get_proc_address("glDeleteRenderbuffersEXT")); + glFramebufferRenderbuffer = reinterpret_cast(get_proc_address("glFramebufferRenderbufferEXT")); + glFramebufferTexture1D = reinterpret_cast(get_proc_address("glFramebufferTexture1DEXT")); + glFramebufferTexture2D = reinterpret_cast(get_proc_address("glFramebufferTexture2DEXT")); + glFramebufferTexture3D = reinterpret_cast(get_proc_address("glFramebufferTexture3DEXT")); + glGenFramebuffers = reinterpret_cast(get_proc_address("glGenFramebuffersEXT")); + glGenRenderbuffers = reinterpret_cast(get_proc_address("glGenRenderbuffersEXT")); + glGenerateMipmap = reinterpret_cast(get_proc_address("glGenerateMipmapEXT")); + glGetFramebufferAttachmentParameteriv = reinterpret_cast(get_proc_address("glGetFramebufferAttachmentParameterivEXT")); + glGetRenderbufferParameteriv = reinterpret_cast(get_proc_address("glGetRenderbufferParameterivEXT")); + glIsFramebuffer = reinterpret_cast(get_proc_address("glIsFramebufferEXT")); + glIsRenderbuffer = reinterpret_cast(get_proc_address("glIsRenderbufferEXT")); + glRenderbufferStorage = reinterpret_cast(get_proc_address("glRenderbufferStorageEXT")); + return Extension::EXTENSION; + } + return Extension::UNSUPPORTED; } +Extension EXT_framebuffer_object("GL_EXT_framebuffer_object", init_ext_framebuffer_object); + } // namespace GL } // namespace Msp