GRAPHICS: Only manually pull pointers if USE_GLEW not defined

This commit is contained in:
Dries Harnie 2015-05-06 11:24:42 +08:00
parent 9e1b0f1516
commit 5c813a8b64
3 changed files with 10 additions and 4 deletions

View file

@ -52,7 +52,7 @@
#include "engines/grim/registry.h" #include "engines/grim/registry.h"
#if defined (SDL_BACKEND) && defined(GL_ARB_fragment_program) #if defined (SDL_BACKEND) && defined(GL_ARB_fragment_program) && !defined(USE_GLEW)
// We need SDL.h for SDL_GL_GetProcAddress. // We need SDL.h for SDL_GL_GetProcAddress.
#include "backends/platform/sdl/sdl-sys.h" #include "backends/platform/sdl/sdl-sys.h"
@ -177,6 +177,7 @@ void GfxOpenGL::initExtensions() {
} }
#if defined (SDL_BACKEND) && defined(GL_ARB_fragment_program) #if defined (SDL_BACKEND) && defined(GL_ARB_fragment_program)
#ifndef USE_GLEW
union { union {
void *obj_ptr; void *obj_ptr;
void (APIENTRY *func_ptr)(); void (APIENTRY *func_ptr)();
@ -194,6 +195,7 @@ void GfxOpenGL::initExtensions() {
glDeleteProgramsARB = (PFNGLDELETEPROGRAMSARBPROC)u.func_ptr; glDeleteProgramsARB = (PFNGLDELETEPROGRAMSARBPROC)u.func_ptr;
u.obj_ptr = SDL_GL_GetProcAddress("glProgramLocalParameter4fARB"); u.obj_ptr = SDL_GL_GetProcAddress("glProgramLocalParameter4fARB");
glProgramLocalParameter4fARB = (PFNGLPROGRAMLOCALPARAMETER4FARBPROC)u.func_ptr; glProgramLocalParameter4fARB = (PFNGLPROGRAMLOCALPARAMETER4FARBPROC)u.func_ptr;
#endif
const char *extensions = (const char *)glGetString(GL_EXTENSIONS); const char *extensions = (const char *)glGetString(GL_EXTENSIONS);
if (strstr(extensions, "ARB_fragment_program")) { if (strstr(extensions, "ARB_fragment_program")) {

View file

@ -27,7 +27,9 @@
#ifdef USE_OPENGL #ifdef USE_OPENGL
#if defined (SDL_BACKEND) && !defined(__amigaos4__) #ifdef USE_GLEW
#include <GL/glew.h>
#elif defined (SDL_BACKEND) && !defined(__amigaos4__)
#include <SDL_opengl.h> #include <SDL_opengl.h>
#undef ARRAYSIZE #undef ARRAYSIZE
#else #else

View file

@ -48,7 +48,7 @@
namespace Graphics { namespace Graphics {
#if defined(SDL_BACKEND) && !defined(USE_OPENGL_SHADERS) #if defined(SDL_BACKEND) && !defined(USE_GLEW)
static bool framebuffer_object_functions = false; static bool framebuffer_object_functions = false;
static PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebuffer; static PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebuffer;
static PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbuffer; static PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbuffer;
@ -122,10 +122,12 @@ static bool usePackedBuffer() {
FrameBuffer::FrameBuffer(uint width, uint height) : FrameBuffer::FrameBuffer(uint width, uint height) :
_managedTexture(true), _width(width), _height(height), _managedTexture(true), _width(width), _height(height),
_texWidth(nextHigher2(width)), _texHeight(nextHigher2(height)) { _texWidth(nextHigher2(width)), _texHeight(nextHigher2(height)) {
#if defined(SDL_BACKEND) && !defined(USE_OPENGL_SHADERS) #ifdef SDL_BACKEND
if (!Graphics::isExtensionSupported("GL_EXT_framebuffer_object")) { if (!Graphics::isExtensionSupported("GL_EXT_framebuffer_object")) {
error("GL_EXT_framebuffer_object extension is not supported!"); error("GL_EXT_framebuffer_object extension is not supported!");
} }
#endif
#if defined(SDL_BACKEND) && !defined(USE_GLEW)
grabFramebufferObjectPointers(); grabFramebufferObjectPointers();
#endif #endif
glGenTextures(1, &_colorTexture); glGenTextures(1, &_colorTexture);