diff src/render/opengl/SDL_render_gl.c @ 5238:ce4f91138031

Added a hint to control whether the OpenGL driver uses shaders.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 08 Feb 2011 22:40:19 -0800
parents 8efa43b915be
children b530ef003506
line wrap: on
line diff
--- a/src/render/opengl/SDL_render_gl.c	Tue Feb 08 22:11:16 2011 -0800
+++ b/src/render/opengl/SDL_render_gl.c	Tue Feb 08 22:40:19 2011 -0800
@@ -23,6 +23,8 @@
 
 #if SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED
 
+#include "SDL_hints.h"
+#include "SDL_log.h"
 #include "SDL_opengl.h"
 #include "../SDL_sysrender.h"
 #include "SDL_shaders_gl.h"
@@ -183,6 +185,7 @@
 {
     SDL_Renderer *renderer;
     GL_RenderData *data;
+    const char *hint;
     GLint value;
     Uint32 window_flags;
 
@@ -282,7 +285,12 @@
     }
 
     /* Check for shader support */
-    data->shaders = GL_CreateShaderContext();
+    hint = SDL_GetHint(SDL_HINT_RENDER_OPENGL_SHADERS);
+    if (!hint || *hint != '0') {
+        data->shaders = GL_CreateShaderContext();
+    }
+    SDL_LogInfo(SDL_LOG_CATEGORY_RENDER, "OpenGL shaders: %s",
+                data->shaders ? "ENABLED" : "DISABLED");
 
 #if 0
     /* We support YV12 textures using 3 textures and a shader */