[vlc-commits] [OpenGL] Fix OpenGL glsl shader version numbers.

Adrien Maglo git at videolan.org
Sat Dec 29 17:51:56 CET 2012


vlc | branch: master | Adrien Maglo <magsoft at videolan.org> | Sat Dec 29 17:51:48 2012 +0100| [d5505899124ae95ff8f86db4bcd1f75f407ba6a2] | committer: Adrien Maglo

[OpenGL] Fix OpenGL glsl shader version numbers.
It seems that standard OpenGL 2.0 requires version number to be equal to 120 contrary to OpenGL ES 2.0 that requires it to be equal to 100.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d5505899124ae95ff8f86db4bcd1f75f407ba6a2
---

 modules/video_output/opengl.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c
index 8dd0fe2..16dc428 100644
--- a/modules/video_output/opengl.c
+++ b/modules/video_output/opengl.c
@@ -191,7 +191,11 @@ static void BuildVertexShader(vout_display_opengl_t *vgl,
 {
     /* Basic vertex shader */
     const char *vertexShader =
+#ifdef USE_OPENGL_ES
         "#version 100\n"
+#else
+        "#version 120\n"
+#endif
         "varying   vec4 TexCoord0,TexCoord1, TexCoord2;"
         "attribute vec4 MultiTexCoord0,MultiTexCoord1,MultiTexCoord2;"
         "attribute vec4 VertexPosition;"
@@ -234,7 +238,11 @@ static void BuildYUVFragmentShader(vout_display_opengl_t *vgl,
 
     /* Basic linear YUV -> RGB conversion using bilinear interpolation */
     const char *template_glsl_yuv =
+#ifdef USE_OPENGL_ES
         "#version 100\n"
+#else
+        "#version 120\n"
+#endif
         "uniform sampler2D Texture0;"
         "uniform sampler2D Texture1;"
         "uniform sampler2D Texture2;"
@@ -284,7 +292,11 @@ static void BuildRGBFragmentShader(vout_display_opengl_t *vgl,
 {
     // Simple shader for RGB
     const char *code =
+#ifdef USE_OPENGL_ES
         "#version 100\n"
+#else
+        "#version 120\n"
+#endif
         "uniform sampler2D Texture[3];"
         "varying vec4 TexCoord0,TexCoord1,TexCoord2;"
         "void main()"
@@ -301,7 +313,11 @@ static void BuildRGBAFragmentShader(vout_display_opengl_t *vgl,
 {
     // Simple shader for RGBA
     const char *code =
+#ifdef USE_OPENGL_ES
         "#version 100\n"
+#else
+        "#version 120\n"
+#endif
         "uniform sampler2D Texture;"
         "uniform vec4 FillColor;"
         "varying vec4 TexCoord0;"



More information about the vlc-commits mailing list