diff pytouhou/ui/opengl/shader.pyx @ 557:0f2af7552462

Don’t hardcode GLSL version in our shaders, instead make them dependent on GL version.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 30 May 2014 16:40:36 +0200
parents 6e3b3d5d4691
children b8df946d394d
line wrap: on
line diff
--- a/pytouhou/ui/opengl/shader.pyx
+++ b/pytouhou/ui/opengl/shader.pyx
@@ -18,6 +18,7 @@ from pytouhou.lib.opengl cimport \
           glUniform4fv, glUniformMatrix4fv, glBindAttribLocation)
 
 from libc.stdlib cimport malloc, free
+from .backend cimport shader_header
 
 
 class GLSLException(Exception):
@@ -51,13 +52,14 @@ cdef class Shader:
 
     cdef void create_shader(self, const GLchar *string, GLenum shader_type):
         cdef GLint temp
-        cdef const GLchar **strings = &string
+        cdef const GLchar *strings[2]
+        strings[:] = [shader_header, string]
 
         # create the shader handle
         shader = glCreateShader(shader_type)
 
         # upload the source strings
-        glShaderSource(shader, 1, strings, NULL)
+        glShaderSource(shader, 2, strings, NULL)
 
         # compile the shader
         glCompileShader(shader)