forked from organicmaps/organicmaps
[win32,opengl]: Added two-variant OpenGL procedures loading — w/wo "EXT" suffix in name.
This commit is contained in:
parent
367cdef15b
commit
9f0570ef8a
4 changed files with 49 additions and 76 deletions
32
yg/internal/gl_procedures.inl
Normal file
32
yg/internal/gl_procedures.inl
Normal file
|
@ -0,0 +1,32 @@
|
|||
// Intentionally no #pragma once
|
||||
|
||||
// buffer objects extensions
|
||||
|
||||
DEFINE_GL_PROC(PFNGLBINDBUFFERPROC, glBindBuffer)
|
||||
DEFINE_GL_PROC(PFNGLGENBUFFERSPROC, glGenBuffers)
|
||||
DEFINE_GL_PROC(PFNGLBUFFERDATAPROC, glBufferData)
|
||||
DEFINE_GL_PROC(PFNGLBUFFERSUBDATAPROC, glBufferSubData)
|
||||
DEFINE_GL_PROC(PFNGLDELETEBUFFERSPROC, glDeleteBuffers)
|
||||
DEFINE_GL_PROC(PFNGLMAPBUFFERPROC, glMapBuffer)
|
||||
DEFINE_GL_PROC(PFNGLUNMAPBUFFERPROC, glUnmapBuffer)
|
||||
|
||||
// framebuffers extensions
|
||||
|
||||
DEFINE_GL_PROC(PFNGLBINDFRAMEBUFFERPROC, glBindFramebuffer)
|
||||
DEFINE_GL_PROC(PFNGLFRAMEBUFFERTEXTURE2DPROC, glFramebufferTexture2D)
|
||||
DEFINE_GL_PROC(PFNGLFRAMEBUFFERRENDERBUFFERPROC, glFramebufferRenderbuffer)
|
||||
DEFINE_GL_PROC(PFNGLGENFRAMEBUFFERSPROC, glGenFramebuffers)
|
||||
DEFINE_GL_PROC(PFNGLDELETEFRAMEBUFFERSPROC, glDeleteFramebuffers)
|
||||
DEFINE_GL_PROC(PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC, glCheckFramebufferStatusEXT)
|
||||
DEFINE_GL_PROC(PFNGLBLITFRAMEBUFFERPROC, glBlitFramebuffer)
|
||||
|
||||
// renderbuffer extensions
|
||||
|
||||
DEFINE_GL_PROC(PFNGLGENRENDERBUFFERSPROC, glGenRenderbuffers)
|
||||
DEFINE_GL_PROC(PFNGLDELETERENDERBUFFERSEXTPROC, glDeleteRenderbuffersEXT)
|
||||
DEFINE_GL_PROC(PFNGLBINDRENDERBUFFEREXTPROC, glBindRenderbufferEXT)
|
||||
DEFINE_GL_PROC(PFNGLRENDERBUFFERSTORAGEEXTPROC, glRenderbufferStorageEXT)
|
||||
|
||||
// multisampling extensions
|
||||
|
||||
DEFINE_GL_PROC(PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC, glRenderbufferStorageMultisample)
|
|
@ -8,27 +8,10 @@
|
|||
|
||||
#ifdef OMIM_OS_WINDOWS
|
||||
|
||||
PFNGLBINDBUFFERPROC glBindBuffer;
|
||||
PFNGLGENBUFFERSPROC glGenBuffers;
|
||||
PFNGLBUFFERDATAPROC glBufferData;
|
||||
PFNGLBUFFERSUBDATAPROC glBufferSubData;
|
||||
PFNGLDELETEBUFFERSPROC glDeleteBuffers;
|
||||
//PFNGLACTIVETEXTUREPROC glActiveTexture;
|
||||
//PFNGLCLIENTACTIVETEXTUREPROC glClientActiveTexture;
|
||||
PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer;
|
||||
PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glRenderbufferStorageMultisample;
|
||||
PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D;
|
||||
PFNGLFRAMEBUFFERRENDERBUFFERPROC glFramebufferRenderbuffer;
|
||||
PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer;
|
||||
PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers;
|
||||
PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers;
|
||||
PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT;
|
||||
PFNGLGENRENDERBUFFERSPROC glGenRenderbuffers;
|
||||
PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT;
|
||||
PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT;
|
||||
PFNGLMAPBUFFERPROC glMapBuffer;
|
||||
PFNGLUNMAPBUFFERPROC glUnmapBuffer;
|
||||
PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT;
|
||||
#define DEFINE_GL_PROC(type, name) \
|
||||
type name;
|
||||
#include "gl_procedures.inl"
|
||||
#undef DEFINE_GL_PROC
|
||||
|
||||
namespace win32
|
||||
{
|
||||
|
@ -48,15 +31,13 @@ namespace win32
|
|||
{
|
||||
HMODULE hInst = 0;
|
||||
|
||||
/// buffer objects extensions
|
||||
|
||||
glBindBuffer = GetGLProc<PFNGLBINDBUFFERPROC>(hInst, "glBindBuffer");
|
||||
glGenBuffers = GetGLProc<PFNGLGENBUFFERSPROC>(hInst, "glGenBuffers");
|
||||
glBufferData = GetGLProc<PFNGLBUFFERDATAPROC>(hInst, "glBufferData");
|
||||
glBufferSubData = GetGLProc<PFNGLBUFFERSUBDATAPROC>(hInst, "glBufferSubData");
|
||||
glDeleteBuffers = GetGLProc<PFNGLDELETEBUFFERSPROC>(hInst, "glDeleteBuffers");
|
||||
glMapBuffer = GetGLProc<PFNGLMAPBUFFERPROC>(hInst, "glMapBuffer");
|
||||
glUnmapBuffer = GetGLProc<PFNGLUNMAPBUFFERPROC>(hInst, "glUnmapBuffer");
|
||||
// Loading procedures, trying "EXT" suffix if alias doesn't exist
|
||||
#define DEFINE_GL_PROC(type, name) \
|
||||
name = GetGLProc<type>(hInst, #name); \
|
||||
if (name == NULL) \
|
||||
name = GetGLProc<type>(hInst, #name ## "EXT");
|
||||
#include "gl_procedures.inl"
|
||||
#undef DEFINE_GL_PROC
|
||||
|
||||
yg::gl::g_isBufferObjectsSupported = glBindBuffer
|
||||
&& glGenBuffers
|
||||
|
@ -66,19 +47,6 @@ namespace win32
|
|||
&& glMapBuffer
|
||||
&& glUnmapBuffer;
|
||||
|
||||
// glActiveTexture = GetGLProc<PFNGLACTIVETEXTUREPROC>(hInst, "glActiveTexture");
|
||||
// glClientActiveTexture = GetGLProc<PFNGLCLIENTACTIVETEXTUREPROC>(hInst, "glClientActiveTexture");
|
||||
|
||||
/// framebuffers extensions
|
||||
|
||||
glBindFramebuffer = GetGLProc<PFNGLBINDFRAMEBUFFERPROC>(hInst, "glBindFramebuffer");
|
||||
glFramebufferTexture2D = GetGLProc<PFNGLFRAMEBUFFERTEXTURE2DPROC>(hInst, "glFramebufferTexture2D");
|
||||
glFramebufferRenderbuffer = GetGLProc<PFNGLFRAMEBUFFERRENDERBUFFERPROC>(hInst, "glFramebufferRenderbuffer");
|
||||
glGenFramebuffers = GetGLProc<PFNGLGENFRAMEBUFFERSPROC>(hInst, "glGenFramebuffers");
|
||||
glDeleteFramebuffers = GetGLProc<PFNGLDELETEFRAMEBUFFERSPROC>(hInst, "glDeleteFramebuffers");
|
||||
glCheckFramebufferStatusEXT = GetGLProc<PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC>(hInst, "glCheckFramebufferStatusEXT");
|
||||
glBlitFramebuffer = GetGLProc<PFNGLBLITFRAMEBUFFERPROC>(hInst, "glBlitFramebuffer");
|
||||
|
||||
yg::gl::g_isFramebufferSupported = glBindFramebuffer
|
||||
&& glFramebufferTexture2D
|
||||
&& glFramebufferRenderbuffer
|
||||
|
@ -87,24 +55,13 @@ namespace win32
|
|||
&& glCheckFramebufferStatusEXT
|
||||
&& glBlitFramebuffer;
|
||||
|
||||
/// renderbuffer extensions
|
||||
|
||||
glGenRenderbuffers = GetGLProc<PFNGLGENRENDERBUFFERSPROC>(hInst, "glGenRenderbuffers");
|
||||
glDeleteRenderbuffersEXT = GetGLProc<PFNGLDELETERENDERBUFFERSEXTPROC>(hInst, "glDeleteRenderbuffersEXT");
|
||||
glBindRenderbufferEXT = GetGLProc<PFNGLBINDRENDERBUFFEREXTPROC>(hInst, "glBindRenderbufferEXT");
|
||||
glRenderbufferStorageEXT = GetGLProc<PFNGLRENDERBUFFERSTORAGEEXTPROC>(hInst, "glRenderbufferStorageEXT");
|
||||
|
||||
yg::gl::g_isRenderbufferSupported = glGenRenderbuffers
|
||||
&& glDeleteRenderbuffersEXT
|
||||
&& glBindRenderbufferEXT
|
||||
&& glRenderbufferStorageEXT;
|
||||
|
||||
/// multisampling extensions
|
||||
|
||||
glRenderbufferStorageMultisample = GetGLProc<PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC>(hInst, "glRenderbufferStorageMultisample");
|
||||
|
||||
yg::gl::g_isMultisamplingSupported = (glRenderbufferStorageMultisample != NULL);
|
||||
}
|
||||
}
|
||||
} // namespace win32
|
||||
|
||||
#endif
|
||||
|
|
|
@ -8,27 +8,10 @@
|
|||
#include <gl/GL.h>
|
||||
#include "../../3party/GL/glext.h"
|
||||
|
||||
extern PFNGLBINDBUFFERPROC glBindBuffer;
|
||||
extern PFNGLGENBUFFERSPROC glGenBuffers;
|
||||
extern PFNGLBUFFERDATAPROC glBufferData;
|
||||
extern PFNGLBUFFERSUBDATAPROC glBufferSubData;
|
||||
extern PFNGLDELETEBUFFERSPROC glDeleteBuffers;
|
||||
extern PFNGLACTIVETEXTUREPROC glActiveTexture;
|
||||
extern PFNGLCLIENTACTIVETEXTUREPROC glClientActiveTexture;
|
||||
extern PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer;
|
||||
extern PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer;
|
||||
extern PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glRenderbufferStorageMultisample;
|
||||
extern PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D;
|
||||
extern PFNGLFRAMEBUFFERRENDERBUFFERPROC glFramebufferRenderbuffer;
|
||||
extern PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers;
|
||||
extern PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers;
|
||||
extern PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT;
|
||||
extern PFNGLGENRENDERBUFFERSPROC glGenRenderbuffers;
|
||||
extern PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT;
|
||||
extern PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT;
|
||||
extern PFNGLMAPBUFFERPROC glMapBuffer;
|
||||
extern PFNGLUNMAPBUFFERPROC glUnmapBuffer;
|
||||
extern PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT;
|
||||
#define DEFINE_GL_PROC(type, name) \
|
||||
extern type name;
|
||||
#include "gl_procedures.inl"
|
||||
#undef DEFINE_GL_PROC
|
||||
|
||||
namespace yg
|
||||
{
|
||||
|
|
|
@ -61,6 +61,7 @@ SOURCES += \
|
|||
|
||||
HEADERS += \
|
||||
internal/opengl.hpp \
|
||||
internal/gl_procedures.inl \
|
||||
vertex.hpp \
|
||||
resource_manager.hpp \
|
||||
texture.hpp \
|
||||
|
|
Loading…
Add table
Reference in a new issue