1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-25 09:44:02 +00:00

Merge branch 'experimental' into controllerfixup + bring back BBGE_BUILD_OPENGL_DYNAMIC

# Conflicts:
#	BBGE/Base.cpp
#	BBGE/FrameBuffer.cpp
#	BBGE/Shader.cpp
This commit is contained in:
fgenesis 2021-01-12 02:45:41 +01:00
commit 86cd7950ca
6 changed files with 27 additions and 40 deletions

View file

@ -1,4 +1,4 @@
#/*
/*
Copyright (C) 2007, 2010 - Bit-Blot
This file is part of Aquaria.
@ -55,6 +55,8 @@ extern "C"
#include "../BBGE/MathFunctions.h"
#undef quad // avoid conflict with quad precision types
// Define this to 1 to check types of pointers passed to functions,
// and warn if a type mismatch is detected. In this case,
// the pointer is treated as NULL, to avoid crashing or undefined behavior.

View file

@ -3,6 +3,7 @@
#ifndef BBGE_SKIP_CONFIG_HEADERS
#define BBGE_BUILD_OPENGL_DYNAMIC 1
#define BBGE_BUILD_FMOD_OPENAL_BRIDGE 1
#define BBGE_BUILD_ACHIEVEMENTS_INTERNAL 1
#define BBGE_BUILD_VFS 1

View file

@ -705,6 +705,7 @@ void Core::initGraphicsLibrary(int width, int height, bool fullscreen, bool vsyn
window->open(width, height, fullscreen, bpp, vsync, display, hz);
window->setTitle(appName.c_str());
#ifdef BBGE_BUILD_OPENGL_DYNAMIC
// get GL symbols AFTER opening the window, otherwise we get a super old GL context on windows and nothing works
if (!lookup_all_glsyms())
{
@ -713,6 +714,7 @@ void Core::initGraphicsLibrary(int width, int height, bool fullscreen, bool vsyn
SDL_Quit();
exit_error(os.str());
}
#endif
debugLog("GL vendor, renderer & version:");
debugLog((const char*)glGetString(GL_VENDOR));
@ -827,7 +829,9 @@ void Core::shutdownGraphicsLibrary()
delete window;
window = NULL;
SDL_QuitSubSystem(SDL_INIT_VIDEO);
#ifdef BBGE_BUILD_OPENGL_DYNAMIC
unload_all_glsyms();
#endif
lib_graphics = false;

View file

@ -16,6 +16,7 @@
#include <GL/glext.h>
#ifdef BBGE_BUILD_OPENGL_DYNAMIC
PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT = NULL;
@ -41,6 +42,7 @@ PFNGLUNIFORM2IVARBPROC glUniform2ivARB = NULL;
PFNGLUNIFORM3IVARBPROC glUniform3ivARB = NULL;
PFNGLUNIFORM4IVARBPROC glUniform4ivARB = NULL;
// GL_ARB_shader_objects and related
PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT = NULL;
PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT = NULL;
PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT = NULL;
@ -149,7 +151,6 @@ void unload_all_glsyms()
glGenerateMipmapEXT = NULL;
#if defined(BBGE_BUILD_FRAMEBUFFER)
// set these back to NULL and reload them upon reinit, otherwise they
// might point to a bogus address when the shared library is reloaded.
glIsRenderbufferEXT = NULL;
@ -168,7 +169,6 @@ void unload_all_glsyms()
glFramebufferTexture3DEXT = NULL;
glFramebufferRenderbufferEXT = NULL;
glGetFramebufferAttachmentParameterivEXT = NULL;
#endif
glCreateProgramObjectARB = NULL;
glDeleteObjectARB = NULL;
@ -191,3 +191,5 @@ void unload_all_glsyms()
glUniform3ivARB = NULL;
glUniform4ivARB = NULL;
}
#endif // BBGE_BUILD_OPENGL_DYNAMIC

View file

@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "RenderBase.h"
#include <sstream>
bool Shader::_wasInited = false;
bool Shader::_useShaders = false;
@ -36,46 +35,24 @@ void Shader::staticInit()
_wasInited = true;
debugLog("Initializing shaders...");
/*char *ext = (char*)glGetString( GL_EXTENSIONS );
bool use = true;
if( strstr( ext, "GL_ARB_shading_language_100" ) == NULL )
#ifdef BBGE_BUILD_OPENGL_DYNAMIC
if( !glCreateProgramObjectARB || !glDeleteObjectARB || !glUseProgramObjectARB ||
!glCreateShaderObjectARB || !glCreateShaderObjectARB || !glCompileShaderARB ||
!glGetObjectParameterivARB || !glAttachObjectARB || !glGetInfoLogARB ||
!glLinkProgramARB || !glGetUniformLocationARB || !glGetActiveUniformARB ||
!glUniform1fvARB || !glUniform2fvARB || !glUniform3fvARB || !glUniform4fvARB ||
!glUniform1ivARB || !glUniform2ivARB || !glUniform3ivARB || !glUniform4ivARB)
{
//This extension string indicates that the OpenGL Shading Language,
// version 1.00, is supported.
debugLog("GL_ARB_shading_language_100 extension was not found");
goto end;
glCreateProgramObjectARB = 0;
debugLog("One or more GL_ARB_shader_objects functions were not found");
use = false;
}
#endif
if( strstr( ext, "GL_ARB_shader_objects" ) == NULL )
{
debugLog("GL_ARB_shader_objects extension was not found");
goto end;
}
else*/
// Better to just check if the function pointers are there;
// the driver might truncate the extension string or something. -- fg
{
if( !glCreateProgramObjectARB || !glDeleteObjectARB || !glUseProgramObjectARB ||
!glCreateShaderObjectARB || !glCreateShaderObjectARB || !glCompileShaderARB ||
!glGetObjectParameterivARB || !glAttachObjectARB || !glGetInfoLogARB ||
!glLinkProgramARB || !glGetUniformLocationARB || !glGetActiveUniformARB ||
!glUniform1fvARB || !glUniform2fvARB || !glUniform3fvARB || !glUniform4fvARB ||
!glUniform1ivARB || !glUniform2ivARB || !glUniform3ivARB || !glUniform4ivARB)
{
glCreateProgramObjectARB = 0;
debugLog("One or more GL_ARB_shader_objects functions were not found");
goto end;
}
}
// everything fine when we are here
_useShaders = true;
end:
if (_useShaders)
_useShaders = use;
if (use)
debugLog("Shader support enabled.");
else
debugLog("Shader support not enabled.");

View file

@ -313,6 +313,7 @@ endif(NOT(AQUARIA_EXTRA_DATA_DIR STREQUAL ""))
# 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_BUILD_OPENGL_DYNAMIC=1)
ADD_DEFINITIONS(-DBBGE_BUILD_FMOD_OPENAL_BRIDGE=1)
IF(AQUARIA_USE_VFS)
ADD_DEFINITIONS(-DBBGE_BUILD_VFS=1)