src/render/opengl/SDL_render_gl.c
changeset 5204 daa5463466c5
parent 5203 25ffd4e5255c
child 5224 2178ffe17222
equal deleted inserted replaced
5203:25ffd4e5255c 5204:daa5463466c5
    86     SDL_bool GL_ARB_texture_rectangle_supported;
    86     SDL_bool GL_ARB_texture_rectangle_supported;
    87     int blendMode;
    87     int blendMode;
    88 
    88 
    89     /* OpenGL functions */
    89     /* OpenGL functions */
    90 #define SDL_PROC(ret,func,params) ret (APIENTRY *func) params;
    90 #define SDL_PROC(ret,func,params) ret (APIENTRY *func) params;
    91 #include "../../video/SDL_glfuncs.h"
    91 #include "SDL_glfuncs.h"
    92 #undef SDL_PROC
    92 #undef SDL_PROC
    93 
    93 
    94     void (*glTextureRangeAPPLE) (GLenum target, GLsizei length,
    94     void (*glTextureRangeAPPLE) (GLenum target, GLsizei length,
    95                                  const GLvoid * pointer);
    95                                  const GLvoid * pointer);
    96 } GL_RenderData;
    96 } GL_RenderData;
   159             return -1; \
   159             return -1; \
   160         } \
   160         } \
   161     } while ( 0 );
   161     } while ( 0 );
   162 #endif /* __SDL_NOGETPROCADDR__ */
   162 #endif /* __SDL_NOGETPROCADDR__ */
   163 
   163 
   164 #include "../../video/SDL_glfuncs.h"
   164 #include "SDL_glfuncs.h"
   165 #undef SDL_PROC
   165 #undef SDL_PROC
   166     return 0;
   166     return 0;
   167 }
   167 }
   168 
   168 
   169 SDL_Renderer *
   169 SDL_Renderer *
   211     renderer->info = GL_RenderDriver.info;
   211     renderer->info = GL_RenderDriver.info;
   212     renderer->driverdata = data;
   212     renderer->driverdata = data;
   213 
   213 
   214     renderer->info.flags = SDL_RENDERER_ACCELERATED;
   214     renderer->info.flags = SDL_RENDERER_ACCELERATED;
   215 
   215 
   216     if (GL_LoadFunctions(data) < 0) {
       
   217         GL_DestroyRenderer(renderer);
       
   218         return NULL;
       
   219     }
       
   220 
       
   221     data->context = SDL_GL_CreateContext(window);
   216     data->context = SDL_GL_CreateContext(window);
   222     if (!data->context) {
   217     if (!data->context) {
   223         GL_DestroyRenderer(renderer);
   218         GL_DestroyRenderer(renderer);
   224         return NULL;
   219         return NULL;
   225     }
   220     }
   226     if (SDL_GL_MakeCurrent(window, data->context) < 0) {
   221     if (SDL_GL_MakeCurrent(window, data->context) < 0) {
   227         GL_DestroyRenderer(renderer);
   222         GL_DestroyRenderer(renderer);
   228         return NULL;
   223         return NULL;
   229     }
   224     }
       
   225 
       
   226     if (GL_LoadFunctions(data) < 0) {
       
   227         GL_DestroyRenderer(renderer);
       
   228         return NULL;
       
   229     }
       
   230 
   230 #ifdef __MACOSX__
   231 #ifdef __MACOSX__
   231     /* Enable multi-threaded rendering */
   232     /* Enable multi-threaded rendering */
   232     /* Disabled until Ryan finishes his VBO/PBO code...
   233     /* Disabled until Ryan finishes his VBO/PBO code...
   233        CGLEnable(CGLGetCurrentContext(), kCGLCEMPEngine);
   234        CGLEnable(CGLGetCurrentContext(), kCGLCEMPEngine);
   234      */
   235      */