Mercurial > touhou
diff pytouhou/ui/shader.py @ 394:346614f788f1
Replace gl{Vertex,TexCoord,Color}Pointer with the more modern glVertexAttribPointer.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Wed, 06 Feb 2013 20:57:16 +0100 |
parents | d8aab27a2ab2 |
children |
line wrap: on
line diff
--- a/pytouhou/ui/shader.py +++ b/pytouhou/ui/shader.py @@ -16,7 +16,7 @@ from pyglet.gl import (glCreateProgram, glUseProgram, glGetUniformLocation, glUniform1f, glUniform2f, glUniform3f, glUniform4f, glUniform1i, glUniform2i, glUniform3i, glUniform4i, - glUniformMatrix4fv) + glUniformMatrix4fv, glBindAttribLocation) from ctypes import (c_char, c_char_p, c_int, POINTER, byref, cast, create_string_buffer) @@ -43,6 +43,11 @@ class Shader(object): # create the fragment shader self.createShader(frag, GL_FRAGMENT_SHADER) + #TODO: put those elsewhere. + glBindAttribLocation(self.handle, 0, 'in_position') + glBindAttribLocation(self.handle, 1, 'in_texcoord') + glBindAttribLocation(self.handle, 2, 'in_color') + # attempt to link the program self.link()