Mercurial > touhou
diff pytouhou/ui/opengl/shader.pyx @ 606:3c2f96f1d715
Fix compilation under Cython 0.22, by making the pyx and the pxd declarations’ except clause similar.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Wed, 26 Nov 2014 13:36:38 +0100 |
parents | aca9551ee8b4 |
children | a6af3ff86612 |
line wrap: on
line diff
--- a/pytouhou/ui/opengl/shader.pyx +++ b/pytouhou/ui/opengl/shader.pyx @@ -58,7 +58,7 @@ cdef class Shader: if use_debug_group: glPopDebugGroup() - cdef void create_shader(self, const GLchar *string, GLenum_shader shader_type): + cdef void create_shader(self, const GLchar *string, GLenum_shader shader_type) except *: cdef GLint temp cdef const GLchar *strings[2] strings[:] = [shader_header, string] @@ -91,7 +91,7 @@ cdef class Shader: # all is well, so attach the shader to the program glAttachShader(self.handle, shader) - cdef void link(self): + cdef void link(self) except *: cdef GLint temp # link the program @@ -116,7 +116,7 @@ cdef class Shader: # all is well, so we are linked self.linked = True - cdef GLint get_uniform_location(self, name): + cdef GLint get_uniform_location(self, name) except -1: if isinstance(name, str): name = name.encode() if name not in self.location_cache: @@ -132,11 +132,11 @@ cdef class Shader: # upload a floating point uniform # this program must be currently bound - cdef void uniform_1(self, name, GLfloat val): + cdef void uniform_1(self, name, GLfloat val) except *: glUniform1fv(self.get_uniform_location(name), 1, &val) # upload a vec4 uniform - cdef void uniform_4(self, name, GLfloat a, GLfloat b, GLfloat c, GLfloat d): + cdef void uniform_4(self, name, GLfloat a, GLfloat b, GLfloat c, GLfloat d) except *: cdef GLfloat vals[4] vals[0] = a vals[1] = b @@ -147,7 +147,7 @@ cdef class Shader: # upload a uniform matrix # works with matrices stored as lists, # as well as euclid matrices - cdef void uniform_matrix(self, name, Matrix *mat): + cdef void uniform_matrix(self, name, Matrix *mat) except *: # obtain the uniform location loc = self.get_uniform_location(name) # uplaod the 4x4 floating point matrix