Sync latest from bkaradzic/bgfx
This commit is contained in:
parent
c698457907
commit
530df02484
@ -1,242 +1,242 @@
|
||||
/*
|
||||
* Copyright 2011-2013 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "bgfx_p.h"
|
||||
|
||||
#if (BGFX_CONFIG_RENDERER_OPENGLES2|BGFX_CONFIG_RENDERER_OPENGLES3|BGFX_CONFIG_RENDERER_OPENGL)
|
||||
# include "renderer_gl.h"
|
||||
|
||||
# if BGFX_USE_WGL
|
||||
|
||||
namespace bgfx
|
||||
{
|
||||
PFNWGLGETPROCADDRESSPROC wglGetProcAddress;
|
||||
PFNWGLMAKECURRENTPROC wglMakeCurrent;
|
||||
PFNWGLCREATECONTEXTPROC wglCreateContext;
|
||||
PFNWGLDELETECONTEXTPROC wglDeleteContext;
|
||||
PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB;
|
||||
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB;
|
||||
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
|
||||
|
||||
# define GL_IMPORT(_optional, _proto, _func) _proto _func
|
||||
# include "glimports.h"
|
||||
# undef GL_IMPORT
|
||||
|
||||
void GlContext::create(uint32_t _width, uint32_t _height)
|
||||
{
|
||||
m_opengl32dll = LoadLibrary("opengl32.dll");
|
||||
BGFX_FATAL(NULL != m_opengl32dll, Fatal::UnableToInitialize, "Failed to load opengl32.dll.");
|
||||
|
||||
wglGetProcAddress = (PFNWGLGETPROCADDRESSPROC)GetProcAddress(m_opengl32dll, "wglGetProcAddress");
|
||||
BGFX_FATAL(NULL != wglGetProcAddress, Fatal::UnableToInitialize, "Failed get wglGetProcAddress.");
|
||||
|
||||
wglMakeCurrent = (PFNWGLMAKECURRENTPROC)GetProcAddress(m_opengl32dll, "wglMakeCurrent");
|
||||
BGFX_FATAL(NULL != wglMakeCurrent, Fatal::UnableToInitialize, "Failed get wglMakeCurrent.");
|
||||
|
||||
wglCreateContext = (PFNWGLCREATECONTEXTPROC)GetProcAddress(m_opengl32dll, "wglCreateContext");
|
||||
BGFX_FATAL(NULL != wglCreateContext, Fatal::UnableToInitialize, "Failed get wglCreateContext.");
|
||||
|
||||
wglDeleteContext = (PFNWGLDELETECONTEXTPROC)GetProcAddress(m_opengl32dll, "wglDeleteContext");
|
||||
BGFX_FATAL(NULL != wglDeleteContext, Fatal::UnableToInitialize, "Failed get wglDeleteContext.");
|
||||
|
||||
m_hdc = GetDC(g_bgfxHwnd);
|
||||
BGFX_FATAL(NULL != m_hdc, Fatal::UnableToInitialize, "GetDC failed!");
|
||||
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
memset(&pfd, 0, sizeof(pfd) );
|
||||
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
|
||||
pfd.nVersion = 1;
|
||||
pfd.iPixelType = PFD_TYPE_RGBA;
|
||||
pfd.cColorBits = 32;
|
||||
pfd.cAlphaBits = 8;
|
||||
pfd.cDepthBits = 24;
|
||||
pfd.cStencilBits = 8;
|
||||
pfd.iLayerType = PFD_MAIN_PLANE;
|
||||
|
||||
int pixelFormat = ChoosePixelFormat(m_hdc, &pfd);
|
||||
BGFX_FATAL(0 != pixelFormat, Fatal::UnableToInitialize, "ChoosePixelFormat failed!");
|
||||
|
||||
DescribePixelFormat(m_hdc, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
|
||||
|
||||
BX_TRACE("Pixel format:\n"
|
||||
"\tiPixelType %d\n"
|
||||
"\tcColorBits %d\n"
|
||||
"\tcAlphaBits %d\n"
|
||||
"\tcDepthBits %d\n"
|
||||
"\tcStencilBits %d\n"
|
||||
, pfd.iPixelType
|
||||
, pfd.cColorBits
|
||||
, pfd.cAlphaBits
|
||||
, pfd.cDepthBits
|
||||
, pfd.cStencilBits
|
||||
);
|
||||
|
||||
int result;
|
||||
result = SetPixelFormat(m_hdc, pixelFormat, &pfd);
|
||||
BGFX_FATAL(0 != result, Fatal::UnableToInitialize, "SetPixelFormat failed!");
|
||||
|
||||
m_context = wglCreateContext(m_hdc);
|
||||
BGFX_FATAL(NULL != m_context, Fatal::UnableToInitialize, "wglCreateContext failed!");
|
||||
|
||||
result = wglMakeCurrent(m_hdc, m_context);
|
||||
BGFX_FATAL(0 != result, Fatal::UnableToInitialize, "wglMakeCurrent failed!");
|
||||
|
||||
wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
|
||||
wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
|
||||
wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB");
|
||||
|
||||
if (NULL != wglGetExtensionsStringARB)
|
||||
{
|
||||
BX_TRACE("WGL extensions:");
|
||||
const char* extensions = (const char*)wglGetExtensionsStringARB(m_hdc);
|
||||
if (NULL != extensions)
|
||||
{
|
||||
char name[1024];
|
||||
const char* pos = extensions;
|
||||
const char* end = extensions + strlen(extensions);
|
||||
while (pos < end)
|
||||
{
|
||||
uint32_t len;
|
||||
const char* space = strchr(pos, ' ');
|
||||
if (NULL != space)
|
||||
{
|
||||
len = uint32_min(sizeof(name), (uint32_t)(space - pos) );
|
||||
}
|
||||
else
|
||||
{
|
||||
len = uint32_min(sizeof(name), (uint32_t)strlen(pos) );
|
||||
}
|
||||
|
||||
strncpy(name, pos, len);
|
||||
name[len] = '\0';
|
||||
|
||||
BX_TRACE("\t%s", name);
|
||||
|
||||
pos += len+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// An application can only set the pixel format of a window one time.
|
||||
// Once a window's pixel format is set, it cannot be changed.
|
||||
// MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/dd369049%28v=vs.85%29.aspx
|
||||
if (NULL != wglChoosePixelFormatARB
|
||||
&& NULL != wglCreateContextAttribsARB)
|
||||
{
|
||||
int32_t attrs[] =
|
||||
{
|
||||
WGL_SAMPLE_BUFFERS_ARB, 0,
|
||||
WGL_SAMPLES_ARB, 0,
|
||||
WGL_SUPPORT_OPENGL_ARB, true,
|
||||
WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,
|
||||
WGL_DRAW_TO_WINDOW_ARB, true,
|
||||
WGL_DOUBLE_BUFFER_ARB, true,
|
||||
WGL_RED_BITS_ARB, 8,
|
||||
WGL_BLUE_BITS_ARB, 8,
|
||||
WGL_GREEN_BITS_ARB, 8,
|
||||
WGL_ALPHA_BITS_ARB, 8,
|
||||
WGL_DEPTH_BITS_ARB, 24,
|
||||
WGL_STENCIL_BITS_ARB, 8,
|
||||
0
|
||||
};
|
||||
|
||||
uint32_t numFormats = 0;
|
||||
do
|
||||
{
|
||||
result = wglChoosePixelFormatARB(m_hdc, attrs, NULL, 1, &pixelFormat, &numFormats);
|
||||
if (0 == result
|
||||
|| 0 == numFormats)
|
||||
{
|
||||
attrs[3] >>= 1;
|
||||
attrs[1] = attrs[3] == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
} while (0 == numFormats);
|
||||
|
||||
DescribePixelFormat(m_hdc, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
|
||||
|
||||
BX_TRACE("Pixel format:\n"
|
||||
"\tiPixelType %d\n"
|
||||
"\tcColorBits %d\n"
|
||||
"\tcAlphaBits %d\n"
|
||||
"\tcDepthBits %d\n"
|
||||
"\tcStencilBits %d\n"
|
||||
, pfd.iPixelType
|
||||
, pfd.cColorBits
|
||||
, pfd.cAlphaBits
|
||||
, pfd.cDepthBits
|
||||
, pfd.cStencilBits
|
||||
);
|
||||
|
||||
result = SetPixelFormat(m_hdc, pixelFormat, &pfd);
|
||||
BGFX_FATAL(0 != result, Fatal::UnableToInitialize, "SetPixelFormat failed (last err: 0x%08x)!", GetLastError() );
|
||||
|
||||
wglMakeCurrent(m_hdc, NULL);
|
||||
wglDeleteContext(m_context);
|
||||
|
||||
const int32_t contextAttrs[] =
|
||||
{
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, 2,
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB, 1,
|
||||
#if BGFX_CONFIG_DEBUG
|
||||
WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_DEBUG_BIT_ARB,
|
||||
#endif // BGFX_CONFIG_DEBUG
|
||||
0
|
||||
};
|
||||
|
||||
m_context = wglCreateContextAttribsARB(m_hdc, 0, contextAttrs);
|
||||
|
||||
result = wglMakeCurrent(m_hdc, m_context);
|
||||
BGFX_FATAL(0 != result, Fatal::UnableToInitialize, "wglMakeCurrent failed!");
|
||||
}
|
||||
#endif // 0
|
||||
|
||||
import();
|
||||
}
|
||||
|
||||
void GlContext::destroy()
|
||||
{
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
|
||||
wglDeleteContext(m_context);
|
||||
m_context = NULL;
|
||||
|
||||
ReleaseDC(g_bgfxHwnd, m_hdc);
|
||||
m_hdc = NULL;
|
||||
|
||||
FreeLibrary(m_opengl32dll);
|
||||
m_opengl32dll = NULL;
|
||||
}
|
||||
|
||||
void GlContext::resize(uint32_t _width, uint32_t _height)
|
||||
{
|
||||
}
|
||||
|
||||
void GlContext::swap()
|
||||
{
|
||||
wglMakeCurrent(m_hdc, m_context);
|
||||
SwapBuffers(m_hdc);
|
||||
}
|
||||
|
||||
void GlContext::import()
|
||||
{
|
||||
# define GL_IMPORT(_optional, _proto, _func) \
|
||||
{ \
|
||||
_func = (_proto)wglGetProcAddress(#_func); \
|
||||
if (_func == NULL) \
|
||||
{ \
|
||||
_func = (_proto)GetProcAddress(m_opengl32dll, #_func); \
|
||||
} \
|
||||
BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGL context. wglGetProcAddress(\"%s\")", #_func); \
|
||||
}
|
||||
# include "glimports.h"
|
||||
# undef GL_IMPORT
|
||||
}
|
||||
|
||||
} // namespace bgfx
|
||||
|
||||
# endif // BGFX_USE_WGL
|
||||
#endif // (BGFX_CONFIG_RENDERER_OPENGLES2|BGFX_CONFIG_RENDERER_OPENGLES3|BGFX_CONFIG_RENDERER_OPENGL)
|
||||
/*
|
||||
* Copyright 2011-2013 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "bgfx_p.h"
|
||||
|
||||
#if (BGFX_CONFIG_RENDERER_OPENGLES2|BGFX_CONFIG_RENDERER_OPENGLES3|BGFX_CONFIG_RENDERER_OPENGL)
|
||||
# include "renderer_gl.h"
|
||||
|
||||
# if BGFX_USE_WGL
|
||||
|
||||
namespace bgfx
|
||||
{
|
||||
PFNWGLGETPROCADDRESSPROC wglGetProcAddress;
|
||||
PFNWGLMAKECURRENTPROC wglMakeCurrent;
|
||||
PFNWGLCREATECONTEXTPROC wglCreateContext;
|
||||
PFNWGLDELETECONTEXTPROC wglDeleteContext;
|
||||
PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB;
|
||||
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB;
|
||||
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
|
||||
|
||||
# define GL_IMPORT(_optional, _proto, _func) _proto _func
|
||||
# include "glimports.h"
|
||||
# undef GL_IMPORT
|
||||
|
||||
void GlContext::create(uint32_t _width, uint32_t _height)
|
||||
{
|
||||
m_opengl32dll = LoadLibrary("opengl32.dll");
|
||||
BGFX_FATAL(NULL != m_opengl32dll, Fatal::UnableToInitialize, "Failed to load opengl32.dll.");
|
||||
|
||||
wglGetProcAddress = (PFNWGLGETPROCADDRESSPROC)GetProcAddress(m_opengl32dll, "wglGetProcAddress");
|
||||
BGFX_FATAL(NULL != wglGetProcAddress, Fatal::UnableToInitialize, "Failed get wglGetProcAddress.");
|
||||
|
||||
wglMakeCurrent = (PFNWGLMAKECURRENTPROC)GetProcAddress(m_opengl32dll, "wglMakeCurrent");
|
||||
BGFX_FATAL(NULL != wglMakeCurrent, Fatal::UnableToInitialize, "Failed get wglMakeCurrent.");
|
||||
|
||||
wglCreateContext = (PFNWGLCREATECONTEXTPROC)GetProcAddress(m_opengl32dll, "wglCreateContext");
|
||||
BGFX_FATAL(NULL != wglCreateContext, Fatal::UnableToInitialize, "Failed get wglCreateContext.");
|
||||
|
||||
wglDeleteContext = (PFNWGLDELETECONTEXTPROC)GetProcAddress(m_opengl32dll, "wglDeleteContext");
|
||||
BGFX_FATAL(NULL != wglDeleteContext, Fatal::UnableToInitialize, "Failed get wglDeleteContext.");
|
||||
|
||||
m_hdc = GetDC(g_bgfxHwnd);
|
||||
BGFX_FATAL(NULL != m_hdc, Fatal::UnableToInitialize, "GetDC failed!");
|
||||
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
memset(&pfd, 0, sizeof(pfd) );
|
||||
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
|
||||
pfd.nVersion = 1;
|
||||
pfd.iPixelType = PFD_TYPE_RGBA;
|
||||
pfd.cColorBits = 32;
|
||||
pfd.cAlphaBits = 8;
|
||||
pfd.cDepthBits = 24;
|
||||
pfd.cStencilBits = 8;
|
||||
pfd.iLayerType = PFD_MAIN_PLANE;
|
||||
|
||||
int pixelFormat = ChoosePixelFormat(m_hdc, &pfd);
|
||||
BGFX_FATAL(0 != pixelFormat, Fatal::UnableToInitialize, "ChoosePixelFormat failed!");
|
||||
|
||||
DescribePixelFormat(m_hdc, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
|
||||
|
||||
BX_TRACE("Pixel format:\n"
|
||||
"\tiPixelType %d\n"
|
||||
"\tcColorBits %d\n"
|
||||
"\tcAlphaBits %d\n"
|
||||
"\tcDepthBits %d\n"
|
||||
"\tcStencilBits %d\n"
|
||||
, pfd.iPixelType
|
||||
, pfd.cColorBits
|
||||
, pfd.cAlphaBits
|
||||
, pfd.cDepthBits
|
||||
, pfd.cStencilBits
|
||||
);
|
||||
|
||||
int result;
|
||||
result = SetPixelFormat(m_hdc, pixelFormat, &pfd);
|
||||
BGFX_FATAL(0 != result, Fatal::UnableToInitialize, "SetPixelFormat failed!");
|
||||
|
||||
m_context = wglCreateContext(m_hdc);
|
||||
BGFX_FATAL(NULL != m_context, Fatal::UnableToInitialize, "wglCreateContext failed!");
|
||||
|
||||
result = wglMakeCurrent(m_hdc, m_context);
|
||||
BGFX_FATAL(0 != result, Fatal::UnableToInitialize, "wglMakeCurrent failed!");
|
||||
|
||||
wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
|
||||
wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
|
||||
wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB");
|
||||
|
||||
if (NULL != wglGetExtensionsStringARB)
|
||||
{
|
||||
BX_TRACE("WGL extensions:");
|
||||
const char* extensions = (const char*)wglGetExtensionsStringARB(m_hdc);
|
||||
if (NULL != extensions)
|
||||
{
|
||||
char name[1024];
|
||||
const char* pos = extensions;
|
||||
const char* end = extensions + strlen(extensions);
|
||||
while (pos < end)
|
||||
{
|
||||
uint32_t len;
|
||||
const char* space = strchr(pos, ' ');
|
||||
if (NULL != space)
|
||||
{
|
||||
len = uint32_min(sizeof(name), (uint32_t)(space - pos) );
|
||||
}
|
||||
else
|
||||
{
|
||||
len = uint32_min(sizeof(name), (uint32_t)strlen(pos) );
|
||||
}
|
||||
|
||||
strncpy(name, pos, len);
|
||||
name[len] = '\0';
|
||||
|
||||
BX_TRACE("\t%s", name);
|
||||
|
||||
pos += len+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// An application can only set the pixel format of a window one time.
|
||||
// Once a window's pixel format is set, it cannot be changed.
|
||||
// MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/dd369049%28v=vs.85%29.aspx
|
||||
if (NULL != wglChoosePixelFormatARB
|
||||
&& NULL != wglCreateContextAttribsARB)
|
||||
{
|
||||
int32_t attrs[] =
|
||||
{
|
||||
WGL_SAMPLE_BUFFERS_ARB, 0,
|
||||
WGL_SAMPLES_ARB, 0,
|
||||
WGL_SUPPORT_OPENGL_ARB, true,
|
||||
WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,
|
||||
WGL_DRAW_TO_WINDOW_ARB, true,
|
||||
WGL_DOUBLE_BUFFER_ARB, true,
|
||||
WGL_RED_BITS_ARB, 8,
|
||||
WGL_BLUE_BITS_ARB, 8,
|
||||
WGL_GREEN_BITS_ARB, 8,
|
||||
WGL_ALPHA_BITS_ARB, 8,
|
||||
WGL_DEPTH_BITS_ARB, 24,
|
||||
WGL_STENCIL_BITS_ARB, 8,
|
||||
0
|
||||
};
|
||||
|
||||
uint32_t numFormats = 0;
|
||||
do
|
||||
{
|
||||
result = wglChoosePixelFormatARB(m_hdc, attrs, NULL, 1, &pixelFormat, &numFormats);
|
||||
if (0 == result
|
||||
|| 0 == numFormats)
|
||||
{
|
||||
attrs[3] >>= 1;
|
||||
attrs[1] = attrs[3] == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
} while (0 == numFormats);
|
||||
|
||||
DescribePixelFormat(m_hdc, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
|
||||
|
||||
BX_TRACE("Pixel format:\n"
|
||||
"\tiPixelType %d\n"
|
||||
"\tcColorBits %d\n"
|
||||
"\tcAlphaBits %d\n"
|
||||
"\tcDepthBits %d\n"
|
||||
"\tcStencilBits %d\n"
|
||||
, pfd.iPixelType
|
||||
, pfd.cColorBits
|
||||
, pfd.cAlphaBits
|
||||
, pfd.cDepthBits
|
||||
, pfd.cStencilBits
|
||||
);
|
||||
|
||||
result = SetPixelFormat(m_hdc, pixelFormat, &pfd);
|
||||
BGFX_FATAL(0 != result, Fatal::UnableToInitialize, "SetPixelFormat failed (last err: 0x%08x)!", GetLastError() );
|
||||
|
||||
wglMakeCurrent(m_hdc, NULL);
|
||||
wglDeleteContext(m_context);
|
||||
|
||||
const int32_t contextAttrs[] =
|
||||
{
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, 2,
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB, 1,
|
||||
#if BGFX_CONFIG_DEBUG
|
||||
WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_DEBUG_BIT_ARB,
|
||||
#endif // BGFX_CONFIG_DEBUG
|
||||
0
|
||||
};
|
||||
|
||||
m_context = wglCreateContextAttribsARB(m_hdc, 0, contextAttrs);
|
||||
|
||||
result = wglMakeCurrent(m_hdc, m_context);
|
||||
BGFX_FATAL(0 != result, Fatal::UnableToInitialize, "wglMakeCurrent failed!");
|
||||
}
|
||||
#endif // 0
|
||||
|
||||
import();
|
||||
}
|
||||
|
||||
void GlContext::destroy()
|
||||
{
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
|
||||
wglDeleteContext(m_context);
|
||||
m_context = NULL;
|
||||
|
||||
ReleaseDC(g_bgfxHwnd, m_hdc);
|
||||
m_hdc = NULL;
|
||||
|
||||
FreeLibrary(m_opengl32dll);
|
||||
m_opengl32dll = NULL;
|
||||
}
|
||||
|
||||
void GlContext::resize(uint32_t _width, uint32_t _height)
|
||||
{
|
||||
}
|
||||
|
||||
void GlContext::swap()
|
||||
{
|
||||
wglMakeCurrent(m_hdc, m_context);
|
||||
SwapBuffers(m_hdc);
|
||||
}
|
||||
|
||||
void GlContext::import()
|
||||
{
|
||||
# define GL_IMPORT(_optional, _proto, _func) \
|
||||
{ \
|
||||
_func = (_proto)wglGetProcAddress(#_func); \
|
||||
if (_func == NULL) \
|
||||
{ \
|
||||
_func = (_proto)GetProcAddress(m_opengl32dll, #_func); \
|
||||
} \
|
||||
BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGL context. wglGetProcAddress(\"%s\")", #_func); \
|
||||
}
|
||||
# include "glimports.h"
|
||||
# undef GL_IMPORT
|
||||
}
|
||||
|
||||
} // namespace bgfx
|
||||
|
||||
# endif // BGFX_USE_WGL
|
||||
#endif // (BGFX_CONFIG_RENDERER_OPENGLES2|BGFX_CONFIG_RENDERER_OPENGLES3|BGFX_CONFIG_RENDERER_OPENGL)
|
||||
|
342
src/glimports.h
342
src/glimports.h
@ -1,171 +1,171 @@
|
||||
/*
|
||||
* Copyright 2011-2013 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#ifndef GL_IMPORT
|
||||
# error GL_IMPORT(_optional, _proto, _func) must be defined!
|
||||
#endif // GL_IMPORT
|
||||
|
||||
#if BGFX_CONFIG_RENDERER_OPENGL
|
||||
// OpenGL 2.1 Reference Pages
|
||||
// http://www.opengl.org/sdk/docs/man/
|
||||
|
||||
#if BX_PLATFORM_WINDOWS
|
||||
GL_IMPORT(false, PFNGLGETERRORPROC, glGetError);
|
||||
GL_IMPORT(false, PFNGLREADPIXELSPROC, glReadPixels);
|
||||
GL_IMPORT(false, PFNGLTEXIMAGE2DPROC, glTexImage2D);
|
||||
GL_IMPORT(false, PFNGLTEXSUBIMAGE2DPROC, glTexSubImage2D);
|
||||
GL_IMPORT(false, PFNGLPIXELSTOREI, glPixelStorei);
|
||||
GL_IMPORT(false, PFNGLTEXPARAMETERIPROC, glTexParameteri);
|
||||
GL_IMPORT(false, PFNGLTEXPARAMETERIVPROC, glTexParameteriv);
|
||||
GL_IMPORT(false, PFNGLTEXPARAMETERFPROC, glTexParameterf);
|
||||
GL_IMPORT(false, PFNGLBINDTEXTUREPROC, glBindTexture);
|
||||
GL_IMPORT(false, PFNGLGENTEXTURESPROC, glGenTextures);
|
||||
GL_IMPORT(false, PFNGLDELETETEXTURESPROC, glDeleteTextures);
|
||||
GL_IMPORT(false, PFNGLCOLORMASKPROC, glColorMask);
|
||||
GL_IMPORT(false, PFNGLDEPTHFUNCPROC, glDepthFunc);
|
||||
GL_IMPORT(false, PFNGLDISABLEPROC, glDisable);
|
||||
GL_IMPORT(false, PFNGLVIEWPORTPROC, glViewport);
|
||||
GL_IMPORT(false, PFNGLDRAWELEMENTSPROC, glDrawElements);
|
||||
GL_IMPORT(false, PFNGLGETINTEGERVPROC, glGetIntegerv);
|
||||
GL_IMPORT(false, PFNGLGETFLOATVPROC, glGetFloatv);
|
||||
GL_IMPORT(false, PFNGLGETSTRINGPROC, glGetString);
|
||||
GL_IMPORT(false, PFNGLDRAWARRAYSPROC, glDrawArrays);
|
||||
GL_IMPORT(false, PFNGLBLENDFUNCPROC, glBlendFunc);
|
||||
GL_IMPORT(false, PFNGLBLENDEQUATIONPROC, glBlendEquation);
|
||||
GL_IMPORT(false, PFNGLPOINTSIZEPROC, glPointSize);
|
||||
GL_IMPORT(false, PFNGLCULLFACEPROC, glCullFace);
|
||||
GL_IMPORT(false, PFNGLCLEARPROC, glClear);
|
||||
GL_IMPORT(false, PFNGLSCISSORPROC, glScissor);
|
||||
GL_IMPORT(false, PFNGLENABLEPROC, glEnable);
|
||||
GL_IMPORT(false, PFNGLCLEARSTENCILPROC, glClearStencil);
|
||||
GL_IMPORT(false, PFNGLDEPTHMASKPROC, glDepthMask);
|
||||
GL_IMPORT(false, PFNGLCLEARDEPTHPROC, glClearDepth);
|
||||
GL_IMPORT(false, PFNGLCLEARCOLORPROC, glClearColor);
|
||||
GL_IMPORT(false, PFNGLSTENCILFUNCPROC, glStencilFunc);
|
||||
GL_IMPORT(false, PFNGLSTENCILMASKPROC, glStencilMask);
|
||||
GL_IMPORT(false, PFNGLSTENCILOPPROC, glStencilOp);
|
||||
#endif // BX_PLATFORM_WINDOWS
|
||||
|
||||
GL_IMPORT(false, PFNGLACTIVETEXTUREPROC, glActiveTexture);
|
||||
GL_IMPORT(false, PFNGLCOMPRESSEDTEXIMAGE2DPROC, glCompressedTexImage2D);
|
||||
GL_IMPORT(false, PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC, glCompressedTexSubImage2D);
|
||||
GL_IMPORT(false, PFNGLCOMPRESSEDTEXIMAGE3DPROC, glCompressedTexImage3D);
|
||||
GL_IMPORT(false, PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC, glCompressedTexSubImage3D);
|
||||
GL_IMPORT(false, PFNGLBINDBUFFERPROC, glBindBuffer);
|
||||
GL_IMPORT(false, PFNGLDELETEBUFFERSPROC, glDeleteBuffers);
|
||||
GL_IMPORT(false, PFNGLGENBUFFERSPROC, glGenBuffers);
|
||||
GL_IMPORT(false, PFNGLBUFFERDATAPROC, glBufferData);
|
||||
GL_IMPORT(false, PFNGLBUFFERSUBDATAPROC, glBufferSubData);
|
||||
GL_IMPORT(false, PFNGLCREATEPROGRAMPROC, glCreateProgram);
|
||||
GL_IMPORT(false, PFNGLCREATESHADERPROC, glCreateShader);
|
||||
GL_IMPORT(false, PFNGLDELETEPROGRAMPROC, glDeleteProgram);
|
||||
GL_IMPORT(false, PFNGLDELETESHADERPROC, glDeleteShader);
|
||||
GL_IMPORT(false, PFNGLATTACHSHADERPROC, glAttachShader);
|
||||
GL_IMPORT(false, PFNGLCOMPILESHADERPROC, glCompileShader);
|
||||
GL_IMPORT(false, PFNGLSHADERSOURCEPROC, glShaderSource);
|
||||
GL_IMPORT(false, PFNGLGETSHADERIVPROC, glGetShaderiv);
|
||||
GL_IMPORT(false, PFNGLGETSHADERINFOLOGPROC, glGetShaderInfoLog);
|
||||
GL_IMPORT(false, PFNGLLINKPROGRAMPROC, glLinkProgram);
|
||||
GL_IMPORT(false, PFNGLGETPROGRAMIVPROC, glGetProgramiv);
|
||||
GL_IMPORT(false, PFNGLGETPROGRAMINFOLOGPROC, glGetProgramInfoLog);
|
||||
GL_IMPORT(false, PFNGLUSEPROGRAMPROC, glUseProgram);
|
||||
GL_IMPORT(false, PFNGLGETACTIVEATTRIBPROC, glGetActiveAttrib);
|
||||
GL_IMPORT(false, PFNGLGETATTRIBLOCATIONPROC, glGetAttribLocation);
|
||||
GL_IMPORT(false, PFNGLGETACTIVEUNIFORMPROC, glGetActiveUniform);
|
||||
GL_IMPORT(false, PFNGLGETUNIFORMLOCATIONPROC, glGetUniformLocation);
|
||||
GL_IMPORT(false, PFNGLENABLEVERTEXATTRIBARRAYPROC, glEnableVertexAttribArray);
|
||||
GL_IMPORT(false, PFNGLDISABLEVERTEXATTRIBARRAYPROC, glDisableVertexAttribArray);
|
||||
GL_IMPORT(false, PFNGLVERTEXATTRIBPOINTERPROC, glVertexAttribPointer);
|
||||
GL_IMPORT(false, PFNGLVERTEXATTRIB1FPROC, glVertexAttrib1f);
|
||||
GL_IMPORT(false, PFNGLVERTEXATTRIB2FPROC, glVertexAttrib2f);
|
||||
GL_IMPORT(false, PFNGLVERTEXATTRIB3FPROC, glVertexAttrib3f);
|
||||
GL_IMPORT(false, PFNGLVERTEXATTRIB4FPROC, glVertexAttrib4f);
|
||||
GL_IMPORT(false, PFNGLBINDFRAMEBUFFERPROC, glBindFramebuffer);
|
||||
GL_IMPORT(false, PFNGLGENFRAMEBUFFERSPROC, glGenFramebuffers);
|
||||
GL_IMPORT(false, PFNGLDELETEFRAMEBUFFERSPROC, glDeleteFramebuffers);
|
||||
GL_IMPORT(false, PFNGLCHECKFRAMEBUFFERSTATUSPROC, glCheckFramebufferStatus);
|
||||
GL_IMPORT(false, PFNGLFRAMEBUFFERRENDERBUFFERPROC, glFramebufferRenderbuffer);
|
||||
GL_IMPORT(false, PFNGLFRAMEBUFFERTEXTURE2DPROC, glFramebufferTexture2D);
|
||||
GL_IMPORT(false, PFNGLBINDRENDERBUFFERPROC, glBindRenderbuffer);
|
||||
GL_IMPORT(false, PFNGLGENRENDERBUFFERSPROC, glGenRenderbuffers);
|
||||
GL_IMPORT(false, PFNGLDELETERENDERBUFFERSPROC, glDeleteRenderbuffers);
|
||||
GL_IMPORT(false, PFNGLRENDERBUFFERSTORAGEPROC, glRenderbufferStorage);
|
||||
GL_IMPORT(false, PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC, glRenderbufferStorageMultisample);
|
||||
GL_IMPORT(false, PFNGLUNIFORM1IPROC, glUniform1i);
|
||||
GL_IMPORT(false, PFNGLUNIFORM1IVPROC, glUniform1iv);
|
||||
GL_IMPORT(false, PFNGLUNIFORM1FPROC, glUniform1f);
|
||||
GL_IMPORT(false, PFNGLUNIFORM1FVPROC, glUniform1fv);
|
||||
GL_IMPORT(false, PFNGLUNIFORM2FVPROC, glUniform2fv);
|
||||
GL_IMPORT(false, PFNGLUNIFORM3FVPROC, glUniform3fv);
|
||||
GL_IMPORT(false, PFNGLUNIFORM4FVPROC, glUniform4fv);
|
||||
GL_IMPORT(false, PFNGLUNIFORMMATRIX3FVPROC, glUniformMatrix3fv);
|
||||
GL_IMPORT(false, PFNGLUNIFORMMATRIX4FVPROC, glUniformMatrix4fv);
|
||||
GL_IMPORT(false, PFNGLTEXIMAGE3DPROC, glTexImage3D);
|
||||
GL_IMPORT(false, PFNGLTEXSUBIMAGE3DPROC, glTexSubImage3D);
|
||||
GL_IMPORT(false, PFNGLCOPYTEXSUBIMAGE3DPROC, glCopyTexSubImage3D);
|
||||
GL_IMPORT(false, PFNGLTEXIMAGE2DMULTISAMPLEPROC, glTexImage2DMultisample);
|
||||
|
||||
GL_IMPORT(false, PFNGLGENQUERIESPROC, glGenQueries);
|
||||
GL_IMPORT(false, PFNGLDELETEQUERIESPROC, glDeleteQueries);
|
||||
GL_IMPORT(false, PFNGLBEGINQUERYPROC, glBeginQuery);
|
||||
GL_IMPORT(false, PFNGLENDQUERYPROC, glEndQuery);
|
||||
GL_IMPORT(false, PFNGLGETQUERYIVPROC, glGetQueryiv);
|
||||
GL_IMPORT(false, PFNGLGETQUERYOBJECTIVPROC, glGetQueryObjectiv);
|
||||
GL_IMPORT(false, PFNGLGETQUERYOBJECTUIVPROC, glGetQueryObjectuiv);
|
||||
|
||||
GL_IMPORT(true, PFNGLGETPROGRAMBINARYPROC, glGetProgramBinary);
|
||||
GL_IMPORT(true, PFNGLPROGRAMBINARYPROC, glProgramBinary);
|
||||
GL_IMPORT(true, PFNGLPROGRAMPARAMETERIPROC, glProgramParameteri);
|
||||
|
||||
GL_IMPORT(true, PFNGLBLITFRAMEBUFFERPROC, glBlitFramebuffer);
|
||||
|
||||
GL_IMPORT(true, PFNGLQUERYCOUNTERPROC, glQueryCounter);
|
||||
GL_IMPORT(true, PFNGLGETQUERYOBJECTI64VPROC, glGetQueryObjecti64v);
|
||||
GL_IMPORT(true, PFNGLGETQUERYOBJECTUI64VPROC, glGetQueryObjectui64v);
|
||||
GL_IMPORT(true, PFNGLGETQUERYOBJECTI64VEXTPROC, glGetQueryObjecti64vEXT);
|
||||
GL_IMPORT(true, PFNGLGETQUERYOBJECTUI64VEXTPROC, glGetQueryObjectui64vEXT);
|
||||
|
||||
GL_IMPORT(true, PFNGLSAMPLECOVERAGEARBPROC, glSampleCoverageARB);
|
||||
|
||||
GL_IMPORT(true, PFNGLBINDVERTEXARRAYPROC, glBindVertexArray);
|
||||
GL_IMPORT(true, PFNGLDELETEVERTEXARRAYSPROC, glDeleteVertexArrays);
|
||||
GL_IMPORT(true, PFNGLGENVERTEXARRAYSPROC, glGenVertexArrays);
|
||||
|
||||
GL_IMPORT(true, PFNGLSTENCILFUNCSEPARATEPROC, glStencilFuncSeparate);
|
||||
GL_IMPORT(true, PFNGLSTENCILMASKSEPARATEPROC, glStencilMaskSeparate);
|
||||
GL_IMPORT(true, PFNGLSTENCILOPSEPARATEPROC, glStencilOpSeparate);
|
||||
|
||||
GL_IMPORT(true, PFNGLBLENDFUNCSEPARATEPROC, glBlendFuncSeparate);
|
||||
GL_IMPORT(true, PFNGLBLENDEQUATIONSEPARATEPROC, glBlendEquationSeparate);
|
||||
|
||||
#if BGFX_CONFIG_DEBUG_GREMEDY
|
||||
GL_IMPORT(true, PFNGLSTRINGMARKERGREMEDYPROC, glStringMarkerGREMEDY);
|
||||
GL_IMPORT(true, PFNGLFRAMETERMINATORGREMEDYPROC, glFrameTerminatorGREMEDY);
|
||||
#endif // BGFX_CONFIG_DEBUG_GREMEDY
|
||||
|
||||
#elif BGFX_CONFIG_RENDERER_OPENGLES2
|
||||
|
||||
// OpenGL ES 2.0 Reference Pages
|
||||
// http://www.khronos.org/opengles/sdk/docs/man/
|
||||
|
||||
GL_IMPORT(true, PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC, glGetTranslatedShaderSourceANGLE);
|
||||
GL_IMPORT(true, PFNGLGETPROGRAMBINARYOESPROC, glGetProgramBinaryOES);
|
||||
GL_IMPORT(true, PFNGLPROGRAMBINARYOESPROC, glProgramBinaryOES);
|
||||
|
||||
GL_IMPORT(true, PFNGLBINDVERTEXARRAYOESPROC, glBindVertexArrayOES);
|
||||
GL_IMPORT(true, PFNGLDELETEVERTEXARRAYSOESPROC, glDeleteVertexArraysOES);
|
||||
GL_IMPORT(true, PFNGLGENVERTEXARRAYSOESPROC, glGenVertexArraysOES);
|
||||
|
||||
#endif // BGFX_CONFIG_RENDERER_
|
||||
|
||||
#if BGFX_CONFIG_RENDERER_OPENGL
|
||||
GL_IMPORT(true, PFNGLVERTEXATTRIBDIVISORBGFXPROC, glVertexAttribDivisorARB);
|
||||
GL_IMPORT(true, PFNGLDRAWARRAYSINSTANCEDBGFXPROC, glDrawArraysInstancedARB);
|
||||
GL_IMPORT(true, PFNGLDRAWELEMENTSINSTANCEDBGFXPROC, glDrawElementsInstancedARB);
|
||||
#elif BGFX_CONFIG_RENDERER_OPENGLES2
|
||||
GL_IMPORT(true, PFNGLVERTEXATTRIBDIVISORBGFXPROC, glVertexAttribDivisor);
|
||||
GL_IMPORT(true, PFNGLDRAWARRAYSINSTANCEDBGFXPROC, glDrawArraysInstanced);
|
||||
GL_IMPORT(true, PFNGLDRAWELEMENTSINSTANCEDBGFXPROC, glDrawElementsInstanced);
|
||||
#endif // !BGFX_CONFIG_RENDERER_OPENGLES3
|
||||
/*
|
||||
* Copyright 2011-2013 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#ifndef GL_IMPORT
|
||||
# error GL_IMPORT(_optional, _proto, _func) must be defined!
|
||||
#endif // GL_IMPORT
|
||||
|
||||
#if BGFX_CONFIG_RENDERER_OPENGL
|
||||
// OpenGL 2.1 Reference Pages
|
||||
// http://www.opengl.org/sdk/docs/man/
|
||||
|
||||
#if BX_PLATFORM_WINDOWS
|
||||
GL_IMPORT(false, PFNGLGETERRORPROC, glGetError);
|
||||
GL_IMPORT(false, PFNGLREADPIXELSPROC, glReadPixels);
|
||||
GL_IMPORT(false, PFNGLTEXIMAGE2DPROC, glTexImage2D);
|
||||
GL_IMPORT(false, PFNGLTEXSUBIMAGE2DPROC, glTexSubImage2D);
|
||||
GL_IMPORT(false, PFNGLPIXELSTOREI, glPixelStorei);
|
||||
GL_IMPORT(false, PFNGLTEXPARAMETERIPROC, glTexParameteri);
|
||||
GL_IMPORT(false, PFNGLTEXPARAMETERIVPROC, glTexParameteriv);
|
||||
GL_IMPORT(false, PFNGLTEXPARAMETERFPROC, glTexParameterf);
|
||||
GL_IMPORT(false, PFNGLBINDTEXTUREPROC, glBindTexture);
|
||||
GL_IMPORT(false, PFNGLGENTEXTURESPROC, glGenTextures);
|
||||
GL_IMPORT(false, PFNGLDELETETEXTURESPROC, glDeleteTextures);
|
||||
GL_IMPORT(false, PFNGLCOLORMASKPROC, glColorMask);
|
||||
GL_IMPORT(false, PFNGLDEPTHFUNCPROC, glDepthFunc);
|
||||
GL_IMPORT(false, PFNGLDISABLEPROC, glDisable);
|
||||
GL_IMPORT(false, PFNGLVIEWPORTPROC, glViewport);
|
||||
GL_IMPORT(false, PFNGLDRAWELEMENTSPROC, glDrawElements);
|
||||
GL_IMPORT(false, PFNGLGETINTEGERVPROC, glGetIntegerv);
|
||||
GL_IMPORT(false, PFNGLGETFLOATVPROC, glGetFloatv);
|
||||
GL_IMPORT(false, PFNGLGETSTRINGPROC, glGetString);
|
||||
GL_IMPORT(false, PFNGLDRAWARRAYSPROC, glDrawArrays);
|
||||
GL_IMPORT(false, PFNGLBLENDFUNCPROC, glBlendFunc);
|
||||
GL_IMPORT(false, PFNGLBLENDEQUATIONPROC, glBlendEquation);
|
||||
GL_IMPORT(false, PFNGLPOINTSIZEPROC, glPointSize);
|
||||
GL_IMPORT(false, PFNGLCULLFACEPROC, glCullFace);
|
||||
GL_IMPORT(false, PFNGLCLEARPROC, glClear);
|
||||
GL_IMPORT(false, PFNGLSCISSORPROC, glScissor);
|
||||
GL_IMPORT(false, PFNGLENABLEPROC, glEnable);
|
||||
GL_IMPORT(false, PFNGLCLEARSTENCILPROC, glClearStencil);
|
||||
GL_IMPORT(false, PFNGLDEPTHMASKPROC, glDepthMask);
|
||||
GL_IMPORT(false, PFNGLCLEARDEPTHPROC, glClearDepth);
|
||||
GL_IMPORT(false, PFNGLCLEARCOLORPROC, glClearColor);
|
||||
GL_IMPORT(false, PFNGLSTENCILFUNCPROC, glStencilFunc);
|
||||
GL_IMPORT(false, PFNGLSTENCILMASKPROC, glStencilMask);
|
||||
GL_IMPORT(false, PFNGLSTENCILOPPROC, glStencilOp);
|
||||
#endif // BX_PLATFORM_WINDOWS
|
||||
|
||||
GL_IMPORT(false, PFNGLACTIVETEXTUREPROC, glActiveTexture);
|
||||
GL_IMPORT(false, PFNGLCOMPRESSEDTEXIMAGE2DPROC, glCompressedTexImage2D);
|
||||
GL_IMPORT(false, PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC, glCompressedTexSubImage2D);
|
||||
GL_IMPORT(false, PFNGLCOMPRESSEDTEXIMAGE3DPROC, glCompressedTexImage3D);
|
||||
GL_IMPORT(false, PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC, glCompressedTexSubImage3D);
|
||||
GL_IMPORT(false, PFNGLBINDBUFFERPROC, glBindBuffer);
|
||||
GL_IMPORT(false, PFNGLDELETEBUFFERSPROC, glDeleteBuffers);
|
||||
GL_IMPORT(false, PFNGLGENBUFFERSPROC, glGenBuffers);
|
||||
GL_IMPORT(false, PFNGLBUFFERDATAPROC, glBufferData);
|
||||
GL_IMPORT(false, PFNGLBUFFERSUBDATAPROC, glBufferSubData);
|
||||
GL_IMPORT(false, PFNGLCREATEPROGRAMPROC, glCreateProgram);
|
||||
GL_IMPORT(false, PFNGLCREATESHADERPROC, glCreateShader);
|
||||
GL_IMPORT(false, PFNGLDELETEPROGRAMPROC, glDeleteProgram);
|
||||
GL_IMPORT(false, PFNGLDELETESHADERPROC, glDeleteShader);
|
||||
GL_IMPORT(false, PFNGLATTACHSHADERPROC, glAttachShader);
|
||||
GL_IMPORT(false, PFNGLCOMPILESHADERPROC, glCompileShader);
|
||||
GL_IMPORT(false, PFNGLSHADERSOURCEPROC, glShaderSource);
|
||||
GL_IMPORT(false, PFNGLGETSHADERIVPROC, glGetShaderiv);
|
||||
GL_IMPORT(false, PFNGLGETSHADERINFOLOGPROC, glGetShaderInfoLog);
|
||||
GL_IMPORT(false, PFNGLLINKPROGRAMPROC, glLinkProgram);
|
||||
GL_IMPORT(false, PFNGLGETPROGRAMIVPROC, glGetProgramiv);
|
||||
GL_IMPORT(false, PFNGLGETPROGRAMINFOLOGPROC, glGetProgramInfoLog);
|
||||
GL_IMPORT(false, PFNGLUSEPROGRAMPROC, glUseProgram);
|
||||
GL_IMPORT(false, PFNGLGETACTIVEATTRIBPROC, glGetActiveAttrib);
|
||||
GL_IMPORT(false, PFNGLGETATTRIBLOCATIONPROC, glGetAttribLocation);
|
||||
GL_IMPORT(false, PFNGLGETACTIVEUNIFORMPROC, glGetActiveUniform);
|
||||
GL_IMPORT(false, PFNGLGETUNIFORMLOCATIONPROC, glGetUniformLocation);
|
||||
GL_IMPORT(false, PFNGLENABLEVERTEXATTRIBARRAYPROC, glEnableVertexAttribArray);
|
||||
GL_IMPORT(false, PFNGLDISABLEVERTEXATTRIBARRAYPROC, glDisableVertexAttribArray);
|
||||
GL_IMPORT(false, PFNGLVERTEXATTRIBPOINTERPROC, glVertexAttribPointer);
|
||||
GL_IMPORT(false, PFNGLVERTEXATTRIB1FPROC, glVertexAttrib1f);
|
||||
GL_IMPORT(false, PFNGLVERTEXATTRIB2FPROC, glVertexAttrib2f);
|
||||
GL_IMPORT(false, PFNGLVERTEXATTRIB3FPROC, glVertexAttrib3f);
|
||||
GL_IMPORT(false, PFNGLVERTEXATTRIB4FPROC, glVertexAttrib4f);
|
||||
GL_IMPORT(false, PFNGLBINDFRAMEBUFFERPROC, glBindFramebuffer);
|
||||
GL_IMPORT(false, PFNGLGENFRAMEBUFFERSPROC, glGenFramebuffers);
|
||||
GL_IMPORT(false, PFNGLDELETEFRAMEBUFFERSPROC, glDeleteFramebuffers);
|
||||
GL_IMPORT(false, PFNGLCHECKFRAMEBUFFERSTATUSPROC, glCheckFramebufferStatus);
|
||||
GL_IMPORT(false, PFNGLFRAMEBUFFERRENDERBUFFERPROC, glFramebufferRenderbuffer);
|
||||
GL_IMPORT(false, PFNGLFRAMEBUFFERTEXTURE2DPROC, glFramebufferTexture2D);
|
||||
GL_IMPORT(false, PFNGLBINDRENDERBUFFERPROC, glBindRenderbuffer);
|
||||
GL_IMPORT(false, PFNGLGENRENDERBUFFERSPROC, glGenRenderbuffers);
|
||||
GL_IMPORT(false, PFNGLDELETERENDERBUFFERSPROC, glDeleteRenderbuffers);
|
||||
GL_IMPORT(false, PFNGLRENDERBUFFERSTORAGEPROC, glRenderbufferStorage);
|
||||
GL_IMPORT(false, PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC, glRenderbufferStorageMultisample);
|
||||
GL_IMPORT(false, PFNGLUNIFORM1IPROC, glUniform1i);
|
||||
GL_IMPORT(false, PFNGLUNIFORM1IVPROC, glUniform1iv);
|
||||
GL_IMPORT(false, PFNGLUNIFORM1FPROC, glUniform1f);
|
||||
GL_IMPORT(false, PFNGLUNIFORM1FVPROC, glUniform1fv);
|
||||
GL_IMPORT(false, PFNGLUNIFORM2FVPROC, glUniform2fv);
|
||||
GL_IMPORT(false, PFNGLUNIFORM3FVPROC, glUniform3fv);
|
||||
GL_IMPORT(false, PFNGLUNIFORM4FVPROC, glUniform4fv);
|
||||
GL_IMPORT(false, PFNGLUNIFORMMATRIX3FVPROC, glUniformMatrix3fv);
|
||||
GL_IMPORT(false, PFNGLUNIFORMMATRIX4FVPROC, glUniformMatrix4fv);
|
||||
GL_IMPORT(false, PFNGLTEXIMAGE3DPROC, glTexImage3D);
|
||||
GL_IMPORT(false, PFNGLTEXSUBIMAGE3DPROC, glTexSubImage3D);
|
||||
GL_IMPORT(false, PFNGLCOPYTEXSUBIMAGE3DPROC, glCopyTexSubImage3D);
|
||||
GL_IMPORT(false, PFNGLTEXIMAGE2DMULTISAMPLEPROC, glTexImage2DMultisample);
|
||||
|
||||
GL_IMPORT(false, PFNGLGENQUERIESPROC, glGenQueries);
|
||||
GL_IMPORT(false, PFNGLDELETEQUERIESPROC, glDeleteQueries);
|
||||
GL_IMPORT(false, PFNGLBEGINQUERYPROC, glBeginQuery);
|
||||
GL_IMPORT(false, PFNGLENDQUERYPROC, glEndQuery);
|
||||
GL_IMPORT(false, PFNGLGETQUERYIVPROC, glGetQueryiv);
|
||||
GL_IMPORT(false, PFNGLGETQUERYOBJECTIVPROC, glGetQueryObjectiv);
|
||||
GL_IMPORT(false, PFNGLGETQUERYOBJECTUIVPROC, glGetQueryObjectuiv);
|
||||
|
||||
GL_IMPORT(true, PFNGLGETPROGRAMBINARYPROC, glGetProgramBinary);
|
||||
GL_IMPORT(true, PFNGLPROGRAMBINARYPROC, glProgramBinary);
|
||||
GL_IMPORT(true, PFNGLPROGRAMPARAMETERIPROC, glProgramParameteri);
|
||||
|
||||
GL_IMPORT(true, PFNGLBLITFRAMEBUFFERPROC, glBlitFramebuffer);
|
||||
|
||||
GL_IMPORT(true, PFNGLQUERYCOUNTERPROC, glQueryCounter);
|
||||
GL_IMPORT(true, PFNGLGETQUERYOBJECTI64VPROC, glGetQueryObjecti64v);
|
||||
GL_IMPORT(true, PFNGLGETQUERYOBJECTUI64VPROC, glGetQueryObjectui64v);
|
||||
GL_IMPORT(true, PFNGLGETQUERYOBJECTI64VEXTPROC, glGetQueryObjecti64vEXT);
|
||||
GL_IMPORT(true, PFNGLGETQUERYOBJECTUI64VEXTPROC, glGetQueryObjectui64vEXT);
|
||||
|
||||
GL_IMPORT(true, PFNGLSAMPLECOVERAGEARBPROC, glSampleCoverageARB);
|
||||
|
||||
GL_IMPORT(true, PFNGLBINDVERTEXARRAYPROC, glBindVertexArray);
|
||||
GL_IMPORT(true, PFNGLDELETEVERTEXARRAYSPROC, glDeleteVertexArrays);
|
||||
GL_IMPORT(true, PFNGLGENVERTEXARRAYSPROC, glGenVertexArrays);
|
||||
|
||||
GL_IMPORT(true, PFNGLSTENCILFUNCSEPARATEPROC, glStencilFuncSeparate);
|
||||
GL_IMPORT(true, PFNGLSTENCILMASKSEPARATEPROC, glStencilMaskSeparate);
|
||||
GL_IMPORT(true, PFNGLSTENCILOPSEPARATEPROC, glStencilOpSeparate);
|
||||
|
||||
GL_IMPORT(true, PFNGLBLENDFUNCSEPARATEPROC, glBlendFuncSeparate);
|
||||
GL_IMPORT(true, PFNGLBLENDEQUATIONSEPARATEPROC, glBlendEquationSeparate);
|
||||
|
||||
#if BGFX_CONFIG_DEBUG_GREMEDY
|
||||
GL_IMPORT(true, PFNGLSTRINGMARKERGREMEDYPROC, glStringMarkerGREMEDY);
|
||||
GL_IMPORT(true, PFNGLFRAMETERMINATORGREMEDYPROC, glFrameTerminatorGREMEDY);
|
||||
#endif // BGFX_CONFIG_DEBUG_GREMEDY
|
||||
|
||||
#elif BGFX_CONFIG_RENDERER_OPENGLES2
|
||||
|
||||
// OpenGL ES 2.0 Reference Pages
|
||||
// http://www.khronos.org/opengles/sdk/docs/man/
|
||||
|
||||
GL_IMPORT(true, PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC, glGetTranslatedShaderSourceANGLE);
|
||||
GL_IMPORT(true, PFNGLGETPROGRAMBINARYOESPROC, glGetProgramBinaryOES);
|
||||
GL_IMPORT(true, PFNGLPROGRAMBINARYOESPROC, glProgramBinaryOES);
|
||||
|
||||
GL_IMPORT(true, PFNGLBINDVERTEXARRAYOESPROC, glBindVertexArrayOES);
|
||||
GL_IMPORT(true, PFNGLDELETEVERTEXARRAYSOESPROC, glDeleteVertexArraysOES);
|
||||
GL_IMPORT(true, PFNGLGENVERTEXARRAYSOESPROC, glGenVertexArraysOES);
|
||||
|
||||
#endif // BGFX_CONFIG_RENDERER_
|
||||
|
||||
#if BGFX_CONFIG_RENDERER_OPENGL
|
||||
GL_IMPORT(true, PFNGLVERTEXATTRIBDIVISORBGFXPROC, glVertexAttribDivisorARB);
|
||||
GL_IMPORT(true, PFNGLDRAWARRAYSINSTANCEDBGFXPROC, glDrawArraysInstancedARB);
|
||||
GL_IMPORT(true, PFNGLDRAWELEMENTSINSTANCEDBGFXPROC, glDrawElementsInstancedARB);
|
||||
#elif BGFX_CONFIG_RENDERER_OPENGLES2
|
||||
GL_IMPORT(true, PFNGLVERTEXATTRIBDIVISORBGFXPROC, glVertexAttribDivisor);
|
||||
GL_IMPORT(true, PFNGLDRAWARRAYSINSTANCEDBGFXPROC, glDrawArraysInstanced);
|
||||
GL_IMPORT(true, PFNGLDRAWELEMENTSINSTANCEDBGFXPROC, glDrawElementsInstanced);
|
||||
#endif // !BGFX_CONFIG_RENDERER_OPENGLES3
|
||||
|
6024
src/renderer_gl.cpp
6024
src/renderer_gl.cpp
File diff suppressed because it is too large
Load Diff
1150
src/renderer_gl.h
1150
src/renderer_gl.h
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user