mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +00:00
implement glad into torque.
This commit is contained in:
parent
fd4628a08a
commit
11c3314f66
5 changed files with 18 additions and 19 deletions
|
|
@ -134,7 +134,8 @@ void GFXGLDevice::initGLState()
|
||||||
mCardProfiler = new GFXGLCardProfiler();
|
mCardProfiler = new GFXGLCardProfiler();
|
||||||
mCardProfiler->init();
|
mCardProfiler->init();
|
||||||
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, (GLint*)&mMaxShaderTextures);
|
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, (GLint*)&mMaxShaderTextures);
|
||||||
glGetIntegerv(GL_MAX_TEXTURE_UNITS, (GLint*)&mMaxFFTextures);
|
// JTH: Needs removed, ffp
|
||||||
|
//glGetIntegerv(GL_MAX_TEXTURE_UNITS, (GLint*)&mMaxFFTextures);
|
||||||
glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, (GLint*)&mMaxTRColors);
|
glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, (GLint*)&mMaxTRColors);
|
||||||
mMaxTRColors = getMin( mMaxTRColors, (U32)(GFXTextureTarget::MaxRenderSlotId-1) );
|
mMaxTRColors = getMin( mMaxTRColors, (U32)(GFXTextureTarget::MaxRenderSlotId-1) );
|
||||||
|
|
||||||
|
|
@ -641,7 +642,7 @@ void GFXGLDevice::setLightMaterialInternal(const GFXLightMaterial mat)
|
||||||
|
|
||||||
void GFXGLDevice::setGlobalAmbientInternal(ColorF color)
|
void GFXGLDevice::setGlobalAmbientInternal(ColorF color)
|
||||||
{
|
{
|
||||||
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, (GLfloat*)&color);
|
// ONLY NEEDED ON FFP
|
||||||
}
|
}
|
||||||
|
|
||||||
void GFXGLDevice::setTextureInternal(U32 textureUnit, const GFXTextureObject*texture)
|
void GFXGLDevice::setTextureInternal(U32 textureUnit, const GFXTextureObject*texture)
|
||||||
|
|
@ -697,12 +698,12 @@ void GFXGLDevice::setClipRect( const RectI &inRect )
|
||||||
const F32 right = mClip.point.x + mClip.extent.x;
|
const F32 right = mClip.point.x + mClip.extent.x;
|
||||||
const F32 bottom = mClip.extent.y;
|
const F32 bottom = mClip.extent.y;
|
||||||
const F32 top = 0.0f;
|
const F32 top = 0.0f;
|
||||||
const F32 near = 0.0f;
|
const F32 nearPlane = 0.0f;
|
||||||
const F32 far = 1.0f;
|
const F32 farPlane = 1.0f;
|
||||||
|
|
||||||
const F32 tx = -(right + left)/(right - left);
|
const F32 tx = -(right + left)/(right - left);
|
||||||
const F32 ty = -(top + bottom)/(top - bottom);
|
const F32 ty = -(top + bottom)/(top - bottom);
|
||||||
const F32 tz = -(far + near)/(far - near);
|
const F32 tz = -(farPlane + nearPlane)/(farPlane - nearPlane);
|
||||||
|
|
||||||
static Point4F pt;
|
static Point4F pt;
|
||||||
pt.set(2.0f / (right - left), 0.0f, 0.0f, 0.0f);
|
pt.set(2.0f / (right - left), 0.0f, 0.0f, 0.0f);
|
||||||
|
|
@ -711,7 +712,7 @@ void GFXGLDevice::setClipRect( const RectI &inRect )
|
||||||
pt.set(0.0f, 2.0f/(top - bottom), 0.0f, 0.0f);
|
pt.set(0.0f, 2.0f/(top - bottom), 0.0f, 0.0f);
|
||||||
mProjectionMatrix.setColumn(1, pt);
|
mProjectionMatrix.setColumn(1, pt);
|
||||||
|
|
||||||
pt.set(0.0f, 0.0f, -2.0f/(far - near), 0.0f);
|
pt.set(0.0f, 0.0f, -2.0f/(farPlane - nearPlane), 0.0f);
|
||||||
mProjectionMatrix.setColumn(2, pt);
|
mProjectionMatrix.setColumn(2, pt);
|
||||||
|
|
||||||
pt.set(tx, ty, tz, 1.0f);
|
pt.set(tx, ty, tz, 1.0f);
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,10 @@ namespace GL
|
||||||
{
|
{
|
||||||
void gglPerformBinds()
|
void gglPerformBinds()
|
||||||
{
|
{
|
||||||
// JTH: epoxy has one oddity with windows. You need to bind the context
|
if (!gladLoadGL())
|
||||||
// after creating the context to udpate the internals of epoxy.
|
{
|
||||||
#ifdef TORQUE_OS_WIN
|
AssertFatal(false, "Unable to load GLAD. Make sure your OpenGL drivers are up to date!");
|
||||||
epoxy_handle_external_wglMakeCurrent();
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gglPerformExtensionBinds(void *context)
|
void gglPerformExtensionBinds(void *context)
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,10 @@
|
||||||
#ifndef T_GL_H
|
#ifndef T_GL_H
|
||||||
#define 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
|
// JTH: When we use glad, extensions are chached into simple booleans (ints)
|
||||||
// directly inside of some compatability table.
|
#define gglHasExtension(EXTENSION) GLAD_GL_##EXTENSION
|
||||||
#define gglHasExtension(EXTENSION) epoxy_has_gl_extension("GL_" #EXTENSION)
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,9 @@
|
||||||
#ifdef TORQUE_OPENGL
|
#ifdef TORQUE_OPENGL
|
||||||
|
|
||||||
#include "tGL.h"
|
#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
|
#endif //TORQUE_OPENGL
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,9 @@
|
||||||
#ifdef TORQUE_OS_LINUX
|
#ifdef TORQUE_OS_LINUX
|
||||||
|
|
||||||
#include "tGL.h"
|
#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
|
#endif //TORQUE_OS_LINUX
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue