implement glad into torque.

This commit is contained in:
Jeff Hutchinson 2016-09-11 21:45:28 -04:00
parent fd4628a08a
commit 11c3314f66
5 changed files with 18 additions and 19 deletions

View file

@ -33,11 +33,10 @@ namespace GL
{
void gglPerformBinds()
{
// JTH: epoxy has one oddity with windows. You need to bind the context
// after creating the context to udpate the internals of epoxy.
#ifdef TORQUE_OS_WIN
epoxy_handle_external_wglMakeCurrent();
#endif
if (!gladLoadGL())
{
AssertFatal(false, "Unable to load GLAD. Make sure your OpenGL drivers are up to date!");
}
}
void gglPerformExtensionBinds(void *context)

View file

@ -23,11 +23,10 @@
#ifndef T_GL_H
#define T_GL_H
#include <epoxy/gl.h>
#include <glad/glad.h>
// JTH: This is slow, we should probably check extensions once and cache them
// directly inside of some compatability table.
#define gglHasExtension(EXTENSION) epoxy_has_gl_extension("GL_" #EXTENSION)
// JTH: When we use glad, extensions are chached into simple booleans (ints)
#define gglHasExtension(EXTENSION) GLAD_GL_##EXTENSION
#endif

View file

@ -28,9 +28,9 @@
#ifdef TORQUE_OPENGL
#include "tGL.h"
#include <epoxy/wgl.h>
#include <glad/glad_wgl.h>
#define gglHasWExtension(window, EXTENSION) epoxy_has_wgl_extension(window, "WGL_" # EXTENSION)
#define gglHasWExtension(window, EXTENSION) GLAD_WGL_##EXTENSION
#endif //TORQUE_OPENGL

View file

@ -28,9 +28,9 @@
#ifdef TORQUE_OS_LINUX
#include "tGL.h"
#include <epoxy/glx.h>
#include <glad/glad_glx.h>
#define gglHasXExtension(display, screen, EXTENSION) epoxy_has_glx_extension(display, screen, "GLX_" # EXTENSION)
#define gglHasXExtension(display, screen, EXTENSION)
#endif //TORQUE_OS_LINUX