Prepare for ANGLE support

This commit is contained in:
Joshua Granick
2015-04-30 10:43:09 -07:00
parent b5129ed8a6
commit 41a2c292dd
4 changed files with 23 additions and 2 deletions

View File

@@ -30,7 +30,6 @@
<files id="lime">
<compilerflag value="-DLIME_SDL" if="LIME_SDL" />
<compilerflag value="-Iinclude" />
<file name="src/ExternalInterface.cpp" />
@@ -141,6 +140,7 @@
</section>
<compilerflag value="-DLIME_SDL" />
<compilerflag value="-DNATIVE_TOOLKIT_SDL_ANGLE" if="LIME_SDL_ANGLE" />
<compilerflag value="-D__IPHONEOS__" if="ios" />
<file name="src/backend/sdl/SDLApplication.cpp" />

View File

@@ -22,6 +22,15 @@ namespace lime {
if (flags & WINDOW_FLAG_RESIZABLE) sdlFlags |= SDL_WINDOW_RESIZABLE;
if (flags & WINDOW_FLAG_BORDERLESS) sdlFlags |= SDL_WINDOW_BORDERLESS;
#if defined (HX_WINDOWS) && defined (NATIVE_TOOLKIT_SDL_ANGLE)
SDL_GL_SetAttribute (SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute (SDL_GL_CONTEXT_MAJOR_VERSION, 2);
SDL_GL_SetAttribute (SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_SetHint (SDL_HINT_VIDEO_WIN_D3DCOMPILER, "d3dcompiler_47.dll");
#endif
if (flags & WINDOW_FLAG_DEPTH_BUFFER) {
SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 32 - (flags & WINDOW_FLAG_STENCIL_BUFFER) ? 8 : 0);

View File

@@ -60,6 +60,7 @@
#include <gl/GL.h>
typedef ptrdiff_t GLsizeiptrARB;
#define NEED_EXTENSIONS
#define DYNAMIC_OGL
#include <SDL_opengl.h>
#include <SDL_opengl_glext.h>

View File

@@ -12,6 +12,10 @@
#include "OpenGLBindings.h"
#ifdef LIME_SDL
#include <SDL.h>
#endif
#ifdef DECLARE_EXTENSION
@@ -27,7 +31,14 @@
#elif defined(GET_EXTENSION)
#ifdef HX_WINDOWS
#ifdef LIME_SDL
#define OGL_EXT(func,ret,args) \
{\
*(void **)&lime::func = (void *)SDL_GL_GetProcAddress(#func);\
if (!func) \
*(void **)&lime::func = (void *)SDL_GL_GetProcAddress(#func "ARB");\
}
#elif HX_WINDOWS
#define OGL_EXT(func,ret,args) \
{\
*(void **)&lime::func = (void *)wglGetProcAddress(#func);\