mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-25 09:44:02 +00:00
Remove mandatory defines and their checks:
BBGE_BUILD_SHADERS BBGE_BUILD_FRAMEBUFFER BBGE_BUILD_OPENGL BBGE_BUILD_OPENGL_DYNAMIC
This commit is contained in:
parent
c581ab01d8
commit
7456e785fa
8 changed files with 4 additions and 81 deletions
|
@ -3,10 +3,6 @@
|
||||||
|
|
||||||
#ifndef BBGE_SKIP_CONFIG_HEADERS
|
#ifndef BBGE_SKIP_CONFIG_HEADERS
|
||||||
|
|
||||||
#define BBGE_BUILD_FRAMEBUFFER 1
|
|
||||||
#define BBGE_BUILD_SHADERS 1
|
|
||||||
#define BBGE_BUILD_OPENGL 1
|
|
||||||
#define BBGE_BUILD_OPENGL_DYNAMIC 1
|
|
||||||
#define BBGE_BUILD_FMOD_OPENAL_BRIDGE 1
|
#define BBGE_BUILD_FMOD_OPENAL_BRIDGE 1
|
||||||
#define BBGE_BUILD_ACHIEVEMENTS_INTERNAL 1
|
#define BBGE_BUILD_ACHIEVEMENTS_INTERNAL 1
|
||||||
#define BBGE_BUILD_VFS 1
|
#define BBGE_BUILD_VFS 1
|
||||||
|
|
|
@ -881,7 +881,6 @@ bool Core::initGraphicsLibrary(int width, int height, bool fullscreen, bool vsyn
|
||||||
|
|
||||||
createWindow(width, height, !width && !height, fullscreen);
|
createWindow(width, height, !width && !height, fullscreen);
|
||||||
|
|
||||||
#if BBGE_BUILD_OPENGL_DYNAMIC
|
|
||||||
if (SDL_GL_LoadLibrary(NULL) == -1)
|
if (SDL_GL_LoadLibrary(NULL) == -1)
|
||||||
{
|
{
|
||||||
std::string err = std::string("SDL_GL_LoadLibrary Error: ") + std::string(SDL_GetError());
|
std::string err = std::string("SDL_GL_LoadLibrary Error: ") + std::string(SDL_GetError());
|
||||||
|
@ -896,7 +895,6 @@ bool Core::initGraphicsLibrary(int width, int height, bool fullscreen, bool vsyn
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
exit_error(os.str());
|
exit_error(os.str());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
debugLog("GL vendor, renderer & version:");
|
debugLog("GL vendor, renderer & version:");
|
||||||
debugLog((const char*)glGetString(GL_VENDOR));
|
debugLog((const char*)glGetString(GL_VENDOR));
|
||||||
|
@ -1070,9 +1068,7 @@ void Core::shutdownGraphicsLibrary()
|
||||||
#endif
|
#endif
|
||||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||||
gScreen = 0;
|
gScreen = 0;
|
||||||
#if BBGE_BUILD_OPENGL_DYNAMIC
|
|
||||||
unload_all_glsyms();
|
unload_all_glsyms();
|
||||||
#endif
|
|
||||||
|
|
||||||
_hasFocus = false;
|
_hasFocus = false;
|
||||||
|
|
||||||
|
|
|
@ -58,8 +58,6 @@ float FrameBuffer::getHeightP()
|
||||||
|
|
||||||
bool FrameBuffer::init(int width, int height, bool fitToScreen)
|
bool FrameBuffer::init(int width, int height, bool fitToScreen)
|
||||||
{
|
{
|
||||||
#ifdef BBGE_BUILD_FRAMEBUFFER
|
|
||||||
|
|
||||||
_w = width;
|
_w = width;
|
||||||
_h = height;
|
_h = height;
|
||||||
|
|
||||||
|
@ -157,9 +155,6 @@ bool FrameBuffer::init(int width, int height, bool fitToScreen)
|
||||||
debugLog("Done");
|
debugLog("Done");
|
||||||
inited = true;
|
inited = true;
|
||||||
return true;
|
return true;
|
||||||
#endif
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameBuffer::unloadDevice()
|
void FrameBuffer::unloadDevice()
|
||||||
|
@ -167,10 +162,6 @@ void FrameBuffer::unloadDevice()
|
||||||
debugLog("frameBuffer::unloadDevice");
|
debugLog("frameBuffer::unloadDevice");
|
||||||
inited = false;
|
inited = false;
|
||||||
|
|
||||||
#ifdef BBGE_BUILD_FRAMEBUFFER
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (glDeleteFramebuffersEXT == NULL)
|
if (glDeleteFramebuffersEXT == NULL)
|
||||||
{
|
{
|
||||||
debugLog("Already shut down the GL, don't delete framebuffers");
|
debugLog("Already shut down the GL, don't delete framebuffers");
|
||||||
|
@ -204,7 +195,6 @@ void FrameBuffer::unloadDevice()
|
||||||
g_depthRenderBuffer = 0;
|
g_depthRenderBuffer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
debugLog("done");
|
debugLog("done");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,32 +207,19 @@ void FrameBuffer::reloadDevice()
|
||||||
void FrameBuffer::startCapture()
|
void FrameBuffer::startCapture()
|
||||||
{
|
{
|
||||||
assert(inited);
|
assert(inited);
|
||||||
#ifdef BBGE_BUILD_FRAMEBUFFER
|
|
||||||
|
|
||||||
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, g_frameBuffer );
|
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, g_frameBuffer );
|
||||||
|
|
||||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameBuffer::endCapture()
|
void FrameBuffer::endCapture()
|
||||||
{
|
{
|
||||||
assert(inited);
|
assert(inited);
|
||||||
#ifdef BBGE_BUILD_FRAMEBUFFER
|
|
||||||
|
|
||||||
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
|
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameBuffer::bindTexture()
|
void FrameBuffer::bindTexture()
|
||||||
{
|
{
|
||||||
assert(inited);
|
assert(inited);
|
||||||
#ifdef BBGE_BUILD_FRAMEBUFFER
|
|
||||||
|
|
||||||
glBindTexture( GL_TEXTURE_2D, g_dynamicTextureID );
|
glBindTexture( GL_TEXTURE_2D, g_dynamicTextureID );
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#include "Base.h"
|
#include "Base.h"
|
||||||
|
|
||||||
#if BBGE_BUILD_OPENGL_DYNAMIC
|
|
||||||
|
|
||||||
#include "RenderBase.h"
|
#include "RenderBase.h"
|
||||||
#include "GLLoad.h"
|
#include "GLLoad.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -21,7 +19,6 @@
|
||||||
|
|
||||||
PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT = NULL;
|
PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT = NULL;
|
||||||
|
|
||||||
#ifdef BBGE_BUILD_SHADERS
|
|
||||||
// GL_ARB_shader_objects
|
// GL_ARB_shader_objects
|
||||||
PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB = NULL;
|
PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB = NULL;
|
||||||
PFNGLDELETEOBJECTARBPROC glDeleteObjectARB = NULL;
|
PFNGLDELETEOBJECTARBPROC glDeleteObjectARB = NULL;
|
||||||
|
@ -43,9 +40,7 @@ PFNGLUNIFORM1IVARBPROC glUniform1ivARB = NULL;
|
||||||
PFNGLUNIFORM2IVARBPROC glUniform2ivARB = NULL;
|
PFNGLUNIFORM2IVARBPROC glUniform2ivARB = NULL;
|
||||||
PFNGLUNIFORM3IVARBPROC glUniform3ivARB = NULL;
|
PFNGLUNIFORM3IVARBPROC glUniform3ivARB = NULL;
|
||||||
PFNGLUNIFORM4IVARBPROC glUniform4ivARB = NULL;
|
PFNGLUNIFORM4IVARBPROC glUniform4ivARB = NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BBGE_BUILD_FRAMEBUFFER
|
|
||||||
PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT = NULL;
|
PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT = NULL;
|
||||||
PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT = NULL;
|
PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT = NULL;
|
||||||
PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT = NULL;
|
PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT = NULL;
|
||||||
|
@ -62,13 +57,10 @@ PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT = NULL;
|
||||||
PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT = NULL;
|
PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT = NULL;
|
||||||
PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT = NULL;
|
PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT = NULL;
|
||||||
PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT = NULL;
|
PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT = NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
unsigned g_dbg_numRenderCalls = 0; // extern
|
unsigned g_dbg_numRenderCalls = 0; // extern
|
||||||
|
|
||||||
|
|
||||||
#ifdef BBGE_BUILD_OPENGL_DYNAMIC
|
|
||||||
#define GL_FUNC(ret,fn,params,call,rt) \
|
#define GL_FUNC(ret,fn,params,call,rt) \
|
||||||
extern "C" { \
|
extern "C" { \
|
||||||
static ret (GLAPIENTRY *p##fn) params = NULL; \
|
static ret (GLAPIENTRY *p##fn) params = NULL; \
|
||||||
|
@ -99,9 +91,11 @@ bool lookup_all_glsyms()
|
||||||
#undef GL_FUNC
|
#undef GL_FUNC
|
||||||
|
|
||||||
// optional functions
|
// optional functions
|
||||||
|
|
||||||
|
// mipmaps
|
||||||
glGenerateMipmapEXT = (PFNGLGENERATEMIPMAPEXTPROC)SDL_GL_GetProcAddress("glGenerateMipmapEXT");
|
glGenerateMipmapEXT = (PFNGLGENERATEMIPMAPEXTPROC)SDL_GL_GetProcAddress("glGenerateMipmapEXT");
|
||||||
|
|
||||||
#if defined(BBGE_BUILD_FRAMEBUFFER)
|
// framebuffer
|
||||||
glIsRenderbufferEXT = (PFNGLISRENDERBUFFEREXTPROC)SDL_GL_GetProcAddress("glIsRenderbufferEXT");
|
glIsRenderbufferEXT = (PFNGLISRENDERBUFFEREXTPROC)SDL_GL_GetProcAddress("glIsRenderbufferEXT");
|
||||||
glBindRenderbufferEXT = (PFNGLBINDRENDERBUFFEREXTPROC)SDL_GL_GetProcAddress("glBindRenderbufferEXT");
|
glBindRenderbufferEXT = (PFNGLBINDRENDERBUFFEREXTPROC)SDL_GL_GetProcAddress("glBindRenderbufferEXT");
|
||||||
glDeleteRenderbuffersEXT = (PFNGLDELETERENDERBUFFERSEXTPROC)SDL_GL_GetProcAddress("glDeleteRenderbuffersEXT");
|
glDeleteRenderbuffersEXT = (PFNGLDELETERENDERBUFFERSEXTPROC)SDL_GL_GetProcAddress("glDeleteRenderbuffersEXT");
|
||||||
|
@ -118,9 +112,8 @@ bool lookup_all_glsyms()
|
||||||
glFramebufferTexture3DEXT = (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC)SDL_GL_GetProcAddress("glFramebufferTexture3DEXT");
|
glFramebufferTexture3DEXT = (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC)SDL_GL_GetProcAddress("glFramebufferTexture3DEXT");
|
||||||
glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)SDL_GL_GetProcAddress("glFramebufferRenderbufferEXT");
|
glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)SDL_GL_GetProcAddress("glFramebufferRenderbufferEXT");
|
||||||
glGetFramebufferAttachmentParameterivEXT = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC)SDL_GL_GetProcAddress("glGetFramebufferAttachmentParameterivEXT");
|
glGetFramebufferAttachmentParameterivEXT = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC)SDL_GL_GetProcAddress("glGetFramebufferAttachmentParameterivEXT");
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(BBGE_BUILD_SHADERS)
|
// shaders
|
||||||
glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)SDL_GL_GetProcAddress("glCreateProgramObjectARB");
|
glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)SDL_GL_GetProcAddress("glCreateProgramObjectARB");
|
||||||
glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC)SDL_GL_GetProcAddress("glDeleteObjectARB");
|
glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC)SDL_GL_GetProcAddress("glDeleteObjectARB");
|
||||||
glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)SDL_GL_GetProcAddress("glUseProgramObjectARB");
|
glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)SDL_GL_GetProcAddress("glUseProgramObjectARB");
|
||||||
|
@ -141,22 +134,18 @@ bool lookup_all_glsyms()
|
||||||
glUniform2ivARB = (PFNGLUNIFORM2IVARBPROC)SDL_GL_GetProcAddress("glUniform2ivARB");
|
glUniform2ivARB = (PFNGLUNIFORM2IVARBPROC)SDL_GL_GetProcAddress("glUniform2ivARB");
|
||||||
glUniform3ivARB = (PFNGLUNIFORM3IVARBPROC)SDL_GL_GetProcAddress("glUniform3ivARB");
|
glUniform3ivARB = (PFNGLUNIFORM3IVARBPROC)SDL_GL_GetProcAddress("glUniform3ivARB");
|
||||||
glUniform4ivARB = (PFNGLUNIFORM4IVARBPROC)SDL_GL_GetProcAddress("glUniform4ivARB");
|
glUniform4ivARB = (PFNGLUNIFORM4IVARBPROC)SDL_GL_GetProcAddress("glUniform4ivARB");
|
||||||
#endif
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void unload_all_glsyms()
|
void unload_all_glsyms()
|
||||||
{
|
{
|
||||||
#if BBGE_BUILD_OPENGL_DYNAMIC
|
|
||||||
// reset all the entry points to NULL, so we know exactly what happened
|
// reset all the entry points to NULL, so we know exactly what happened
|
||||||
// if we call a GL function after shutdown.
|
// if we call a GL function after shutdown.
|
||||||
#define GL_FUNC(ret,fn,params,call,rt) \
|
#define GL_FUNC(ret,fn,params,call,rt) \
|
||||||
p##fn = NULL;
|
p##fn = NULL;
|
||||||
#include "OpenGLStubs.h"
|
#include "OpenGLStubs.h"
|
||||||
#undef GL_FUNC
|
#undef GL_FUNC
|
||||||
#endif
|
|
||||||
|
|
||||||
glGenerateMipmapEXT = NULL;
|
glGenerateMipmapEXT = NULL;
|
||||||
|
|
||||||
|
@ -181,7 +170,6 @@ void unload_all_glsyms()
|
||||||
glGetFramebufferAttachmentParameterivEXT = NULL;
|
glGetFramebufferAttachmentParameterivEXT = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(BBGE_BUILD_SHADERS)
|
|
||||||
glCreateProgramObjectARB = NULL;
|
glCreateProgramObjectARB = NULL;
|
||||||
glDeleteObjectARB = NULL;
|
glDeleteObjectARB = NULL;
|
||||||
glUseProgramObjectARB = NULL;
|
glUseProgramObjectARB = NULL;
|
||||||
|
@ -202,8 +190,4 @@ void unload_all_glsyms()
|
||||||
glUniform2ivARB = NULL;
|
glUniform2ivARB = NULL;
|
||||||
glUniform3ivARB = NULL;
|
glUniform3ivARB = NULL;
|
||||||
glUniform4ivARB = NULL;
|
glUniform4ivARB = NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
|
|
||||||
extern PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT;
|
extern PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT;
|
||||||
|
|
||||||
#ifdef BBGE_BUILD_SHADERS
|
|
||||||
// GL_ARB_shader_objects
|
// GL_ARB_shader_objects
|
||||||
extern PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB;
|
extern PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB;
|
||||||
extern PFNGLDELETEOBJECTARBPROC glDeleteObjectARB;
|
extern PFNGLDELETEOBJECTARBPROC glDeleteObjectARB;
|
||||||
|
@ -48,9 +47,7 @@ extern PFNGLUNIFORM1IVARBPROC glUniform1ivARB;
|
||||||
extern PFNGLUNIFORM2IVARBPROC glUniform2ivARB;
|
extern PFNGLUNIFORM2IVARBPROC glUniform2ivARB;
|
||||||
extern PFNGLUNIFORM3IVARBPROC glUniform3ivARB;
|
extern PFNGLUNIFORM3IVARBPROC glUniform3ivARB;
|
||||||
extern PFNGLUNIFORM4IVARBPROC glUniform4ivARB;
|
extern PFNGLUNIFORM4IVARBPROC glUniform4ivARB;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BBGE_BUILD_FRAMEBUFFER
|
|
||||||
extern PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT;
|
extern PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT;
|
||||||
extern PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT;
|
extern PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT;
|
||||||
extern PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT;
|
extern PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT;
|
||||||
|
@ -67,7 +64,6 @@ extern PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT;
|
||||||
extern PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT;
|
extern PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT;
|
||||||
extern PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT;
|
extern PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT;
|
||||||
extern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT;
|
extern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT;
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ void Shader::staticInit()
|
||||||
_wasInited = true;
|
_wasInited = true;
|
||||||
debugLog("Initializing shaders...");
|
debugLog("Initializing shaders...");
|
||||||
|
|
||||||
#if defined(BBGE_BUILD_SHADERS) && defined(BBGE_BUILD_OPENGL)
|
|
||||||
/*char *ext = (char*)glGetString( GL_EXTENSIONS );
|
/*char *ext = (char*)glGetString( GL_EXTENSIONS );
|
||||||
|
|
||||||
if( strstr( ext, "GL_ARB_shading_language_100" ) == NULL )
|
if( strstr( ext, "GL_ARB_shading_language_100" ) == NULL )
|
||||||
|
@ -75,7 +74,6 @@ void Shader::staticInit()
|
||||||
|
|
||||||
|
|
||||||
end:
|
end:
|
||||||
#endif
|
|
||||||
|
|
||||||
if (_useShaders)
|
if (_useShaders)
|
||||||
debugLog("Shader support enabled.");
|
debugLog("Shader support enabled.");
|
||||||
|
@ -98,7 +96,6 @@ Shader::~Shader()
|
||||||
|
|
||||||
void Shader::unload()
|
void Shader::unload()
|
||||||
{
|
{
|
||||||
#ifdef BBGE_BUILD_SHADERS
|
|
||||||
if (!_useShaders)
|
if (!_useShaders)
|
||||||
return;
|
return;
|
||||||
if (g_programObj)
|
if (g_programObj)
|
||||||
|
@ -106,7 +103,6 @@ void Shader::unload()
|
||||||
glDeleteObjectARB( g_programObj );
|
glDeleteObjectARB( g_programObj );
|
||||||
g_programObj = 0;
|
g_programObj = 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Shader::isLoaded() const
|
bool Shader::isLoaded() const
|
||||||
|
@ -124,26 +120,21 @@ void Shader::reload()
|
||||||
|
|
||||||
void Shader::bind()
|
void Shader::bind()
|
||||||
{
|
{
|
||||||
#ifdef BBGE_BUILD_SHADERS
|
|
||||||
if (!_useShaders)
|
if (!_useShaders)
|
||||||
return;
|
return;
|
||||||
glUseProgramObjectARB(g_programObj);
|
glUseProgramObjectARB(g_programObj);
|
||||||
_flushUniforms();
|
_flushUniforms();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shader::unbind()
|
void Shader::unbind()
|
||||||
{
|
{
|
||||||
#ifdef BBGE_BUILD_SHADERS
|
|
||||||
if (!_useShaders)
|
if (!_useShaders)
|
||||||
return;
|
return;
|
||||||
glUseProgramObjectARB(0);
|
glUseProgramObjectARB(0);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int Shader::_compileShader(int type, const char *src, char *errbuf, size_t errbufsize)
|
unsigned int Shader::_compileShader(int type, const char *src, char *errbuf, size_t errbufsize)
|
||||||
{
|
{
|
||||||
#ifdef BBGE_BUILD_SHADERS
|
|
||||||
GLint compiled = 0;
|
GLint compiled = 0;
|
||||||
GLhandleARB handle = glCreateShaderObjectARB(type);
|
GLhandleARB handle = glCreateShaderObjectARB(type);
|
||||||
if(!handle)
|
if(!handle)
|
||||||
|
@ -172,8 +163,6 @@ unsigned int Shader::_compileShader(int type, const char *src, char *errbuf, siz
|
||||||
errorLog(os.str());
|
errorLog(os.str());
|
||||||
}
|
}
|
||||||
return handle;
|
return handle;
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shader::load(const std::string &file, const std::string &fragFile)
|
void Shader::load(const std::string &file, const std::string &fragFile)
|
||||||
|
@ -204,8 +193,6 @@ void Shader::loadSrc(const char *vertCode, const char *fragCode)
|
||||||
if(!_useShaders)
|
if(!_useShaders)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef BBGE_BUILD_SHADERS
|
|
||||||
|
|
||||||
char str[4096];
|
char str[4096];
|
||||||
|
|
||||||
GLhandleARB vertexShader = 0;
|
GLhandleARB vertexShader = 0;
|
||||||
|
@ -280,8 +267,6 @@ void Shader::loadSrc(const char *vertCode, const char *fragCode)
|
||||||
fragSrc = fragCode ? fragCode : "";
|
fragSrc = fragCode ? fragCode : "";
|
||||||
|
|
||||||
_queryUniforms();
|
_queryUniforms();
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shader::_setUniform(Uniform *u)
|
void Shader::_setUniform(Uniform *u)
|
||||||
|
@ -384,7 +369,6 @@ int Shader::_getUniformIndex(const char *name)
|
||||||
|
|
||||||
void Shader::setInt(const char *name, int x, int y /* = 0 */, int z /* = 0 */, int w /* = 0 */)
|
void Shader::setInt(const char *name, int x, int y /* = 0 */, int z /* = 0 */, int w /* = 0 */)
|
||||||
{
|
{
|
||||||
#if BBGE_BUILD_SHADERS
|
|
||||||
if(!g_programObj || numUniforms == 0 || numUniforms == -1)
|
if(!g_programObj || numUniforms == 0 || numUniforms == -1)
|
||||||
return;
|
return;
|
||||||
int idx = _getUniformIndex(name);
|
int idx = _getUniformIndex(name);
|
||||||
|
@ -397,12 +381,10 @@ void Shader::setInt(const char *name, int x, int y /* = 0 */, int z /* = 0 */, i
|
||||||
u.data.i.i[3] = w;
|
u.data.i.i[3] = w;
|
||||||
u.dirty = true;
|
u.dirty = true;
|
||||||
uniformsDirty = true;
|
uniformsDirty = true;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shader::setFloat(const char *name, float x, float y /* = 0 */, float z /* = 0 */, float w /* = 0 */)
|
void Shader::setFloat(const char *name, float x, float y /* = 0 */, float z /* = 0 */, float w /* = 0 */)
|
||||||
{
|
{
|
||||||
#if BBGE_BUILD_SHADERS
|
|
||||||
if(!g_programObj || numUniforms == 0 || numUniforms == -1)
|
if(!g_programObj || numUniforms == 0 || numUniforms == -1)
|
||||||
return;
|
return;
|
||||||
int idx = _getUniformIndex(name);
|
int idx = _getUniformIndex(name);
|
||||||
|
@ -415,5 +397,4 @@ void Shader::setFloat(const char *name, float x, float y /* = 0 */, float z /* =
|
||||||
u.data.f.f[3] = w;
|
u.data.f.f[3] = w;
|
||||||
u.dirty = true;
|
u.dirty = true;
|
||||||
uniformsDirty = true;
|
uniformsDirty = true;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,9 +300,6 @@ endif(NOT(AQUARIA_EXTRA_DATA_DIR STREQUAL ""))
|
||||||
# Aquaria/BBGE specific defines...
|
# Aquaria/BBGE specific defines...
|
||||||
|
|
||||||
ADD_DEFINITIONS(-DBBGE_SKIP_CONFIG_HEADERS=1) # if this is not defined, it will use .h files to set the necessary defines
|
ADD_DEFINITIONS(-DBBGE_SKIP_CONFIG_HEADERS=1) # if this is not defined, it will use .h files to set the necessary defines
|
||||||
ADD_DEFINITIONS(-DBBGE_BUILD_FRAMEBUFFER=1)
|
|
||||||
ADD_DEFINITIONS(-DBBGE_BUILD_SHADERS=1)
|
|
||||||
ADD_DEFINITIONS(-DBBGE_BUILD_OPENGL_DYNAMIC=1)
|
|
||||||
ADD_DEFINITIONS(-DBBGE_BUILD_FMOD_OPENAL_BRIDGE=1)
|
ADD_DEFINITIONS(-DBBGE_BUILD_FMOD_OPENAL_BRIDGE=1)
|
||||||
IF(AQUARIA_USE_VFS)
|
IF(AQUARIA_USE_VFS)
|
||||||
ADD_DEFINITIONS(-DBBGE_BUILD_VFS=1)
|
ADD_DEFINITIONS(-DBBGE_BUILD_VFS=1)
|
||||||
|
|
|
@ -105,7 +105,6 @@ bool GLFont::Create (const char *file_name, int tex, bool loadTexture)
|
||||||
|
|
||||||
if (loadTexture)
|
if (loadTexture)
|
||||||
{
|
{
|
||||||
#ifdef BBGE_BUILD_OPENGL
|
|
||||||
glBindTexture(GL_TEXTURE_2D, tex);
|
glBindTexture(GL_TEXTURE_2D, tex);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
|
@ -128,7 +127,6 @@ bool GLFont::Create (const char *file_name, int tex, bool loadTexture)
|
||||||
//glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
//glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
|
||||||
*/
|
*/
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Free texture pixels memory
|
//Free texture pixels memory
|
||||||
|
@ -253,10 +251,8 @@ int GLFont::GetCharHeight (unsigned char c)
|
||||||
//*******************************************************************
|
//*******************************************************************
|
||||||
void GLFont::Begin (void)
|
void GLFont::Begin (void)
|
||||||
{
|
{
|
||||||
#ifdef BBGE_BUILD_OPENGL
|
|
||||||
//Bind to font texture
|
//Bind to font texture
|
||||||
glBindTexture(GL_TEXTURE_2D, header.tex);
|
glBindTexture(GL_TEXTURE_2D, header.tex);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
//*******************************************************************
|
//*******************************************************************
|
||||||
void GLFont::GetStringSize (const std::string &text, std::pair<int, int> *size)
|
void GLFont::GetStringSize (const std::string &text, std::pair<int, int> *size)
|
||||||
|
|
Loading…
Reference in a new issue