Mercurial > touhou
comparison pytouhou/ui/shader.pyx @ 435:878273a984c4
Improve Matrix representation, using float[16] instead of imbricated python lists.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Wed, 07 Aug 2013 11:34:40 +0200 |
parents | f4d76d3d6f2a |
children | 1b56d62250ab |
comparison
equal
deleted
inserted
replaced
434:18e4b121646b | 435:878273a984c4 |
---|---|
17 GL_LINK_STATUS, glUseProgram, glGetUniformLocation, glUniform1fv, | 17 GL_LINK_STATUS, glUseProgram, glGetUniformLocation, glUniform1fv, |
18 glUniform4fv, glUniformMatrix4fv, glBindAttribLocation, GLint, | 18 glUniform4fv, glUniformMatrix4fv, glBindAttribLocation, GLint, |
19 GLuint, GLchar, GLfloat, GLenum) | 19 GLuint, GLchar, GLfloat, GLenum) |
20 | 20 |
21 from libc.stdlib cimport malloc, free | 21 from libc.stdlib cimport malloc, free |
22 from pytouhou.utils.matrix cimport Matrix, matrix_to_floats | 22 from pytouhou.utils.matrix cimport Matrix |
23 | 23 |
24 | 24 |
25 class GLSLException(Exception): | 25 class GLSLException(Exception): |
26 pass | 26 pass |
27 | 27 |
143 # as well as euclid matrices | 143 # as well as euclid matrices |
144 def uniform_matrix(self, name, Matrix mat): | 144 def uniform_matrix(self, name, Matrix mat): |
145 # obtain the uniform location | 145 # obtain the uniform location |
146 loc = self.get_uniform_location(name) | 146 loc = self.get_uniform_location(name) |
147 # uplaod the 4x4 floating point matrix | 147 # uplaod the 4x4 floating point matrix |
148 glUniformMatrix4fv(loc, 1, False, matrix_to_floats(mat)) | 148 glUniformMatrix4fv(loc, 1, False, mat.data) |