add OPENGL_NO_LINK ability for all platforms

This commit is contained in:
Ted John 2016-06-07 22:12:40 +01:00
parent 876336f455
commit 40bd085f35
3 changed files with 14 additions and 10 deletions

View File

@ -494,7 +494,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>$(OpenRCT2_DEFINES);DEBUG;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>$(OpenRCT2_DEFINES);DEBUG;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ObjectFileName>$(IntDir)\%(RelativeDir)</ObjectFileName>
@ -521,7 +521,7 @@
<TreatSpecificWarningsAsErrors>4013</TreatSpecificWarningsAsErrors>
<OmitFramePointers />
<BufferSecurityCheck>false</BufferSecurityCheck>
<PreprocessorDefinitions>$(OpenRCT2_DEFINES);_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>$(OpenRCT2_DEFINES);OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ObjectFileName>$(IntDir)\%(RelativeDir)</ObjectFileName>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>

View File

@ -16,12 +16,10 @@
#ifndef DISABLE_OPENGL
#include <SDL_platform.h>
#define NO_EXTERN_GLAPI
#include "OpenGLAPI.h"
#if __WINDOWS__
#if OPENGL_NO_LINK
#include <SDL_video.h>
@ -81,11 +79,11 @@ static const char * TryLoadAllProcAddresses()
return nullptr;
}
#endif /* __WINDOWS__ */
#endif /* #if OPENGL_NO_LINK */
bool OpenGLAPI::Initialise()
{
#if __WINDOWS__
#ifdef OPENGL_NO_LINK
const char * failedProcName = TryLoadAllProcAddresses();
if (failedProcName != nullptr)
{

View File

@ -16,6 +16,8 @@
#pragma once
#if OPENGL_NO_LINK
// BEGIN [Do not define 1.1 function signatures]
#define glBegin __static__glBegin
#define glBindTexture __static__glBindTexture
@ -40,8 +42,12 @@
#define glVertex2i __static__glVertex2i
#define glViewport __static__glViewport
#endif
#include <SDL_opengl.h>
#if OPENGL_NO_LINK
// END [Do not define 1.1 function signatures]
#undef glBegin
#undef glBindTexture
@ -90,12 +96,12 @@ typedef void (APIENTRYP PFNGLTRANSLATEFPROC )(GLfloat x, GLfloat y, GLfloat z
typedef void (APIENTRYP PFNGLVERTEX2IPROC )(GLint x, GLint y);
typedef void (APIENTRYP PFNGLVIEWPORTPROC )(GLint x, GLint y, GLsizei width, GLsizei height);
#if __WINDOWS__
#ifdef NO_EXTERN_GLAPI
// Defines the function pointers
#define GLAPI_DECL
#define GLAPI_SET = nullptr
#else
// Defines the functions as "extern"
#define GLAPI_DECL extern
#define GLAPI_SET
#endif
@ -128,7 +134,7 @@ GLAPI_DECL PFNGLVIEWPORTPROC glViewport GLAPI_SET;
GLAPI_DECL PFNGLCREATESHADERPROC glCreateShader GLAPI_SET;
GLAPI_DECL PFNGLDELETESHADERPROC glDeleteShader GLAPI_SET;
#endif /* __WINDOWS__ */
#endif /* OPENGL_NO_LINK */
namespace OpenGLAPI
{