src/render/opengl/SDL_render_gl.c
changeset 5233 ce4f91138031
parent 5230 8efa43b915be
child 5262 b530ef003506
equal deleted inserted replaced
5232:74bc160186a8 5233:ce4f91138031
    21 */
    21 */
    22 #include "SDL_config.h"
    22 #include "SDL_config.h"
    23 
    23 
    24 #if SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED
    24 #if SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED
    25 
    25 
       
    26 #include "SDL_hints.h"
       
    27 #include "SDL_log.h"
    26 #include "SDL_opengl.h"
    28 #include "SDL_opengl.h"
    27 #include "../SDL_sysrender.h"
    29 #include "../SDL_sysrender.h"
    28 #include "SDL_shaders_gl.h"
    30 #include "SDL_shaders_gl.h"
    29 
    31 
    30 #ifdef __MACOSX__
    32 #ifdef __MACOSX__
   181 SDL_Renderer *
   183 SDL_Renderer *
   182 GL_CreateRenderer(SDL_Window * window, Uint32 flags)
   184 GL_CreateRenderer(SDL_Window * window, Uint32 flags)
   183 {
   185 {
   184     SDL_Renderer *renderer;
   186     SDL_Renderer *renderer;
   185     GL_RenderData *data;
   187     GL_RenderData *data;
       
   188     const char *hint;
   186     GLint value;
   189     GLint value;
   187     Uint32 window_flags;
   190     Uint32 window_flags;
   188 
   191 
   189     window_flags = SDL_GetWindowFlags(window);
   192     window_flags = SDL_GetWindowFlags(window);
   190     if (!(window_flags & SDL_WINDOW_OPENGL)) {
   193     if (!(window_flags & SDL_WINDOW_OPENGL)) {
   280             data->glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &data->num_texture_units);
   283             data->glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &data->num_texture_units);
   281         }
   284         }
   282     }
   285     }
   283 
   286 
   284     /* Check for shader support */
   287     /* Check for shader support */
   285     data->shaders = GL_CreateShaderContext();
   288     hint = SDL_GetHint(SDL_HINT_RENDER_OPENGL_SHADERS);
       
   289     if (!hint || *hint != '0') {
       
   290         data->shaders = GL_CreateShaderContext();
       
   291     }
       
   292     SDL_LogInfo(SDL_LOG_CATEGORY_RENDER, "OpenGL shaders: %s",
       
   293                 data->shaders ? "ENABLED" : "DISABLED");
   286 
   294 
   287 #if 0
   295 #if 0
   288     /* We support YV12 textures using 3 textures and a shader */
   296     /* We support YV12 textures using 3 textures and a shader */
   289     if (data->shaders && data->num_texture_units >= 3) {
   297     if (data->shaders && data->num_texture_units >= 3) {
   290         renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12;
   298         renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12;