Mercurial > touhou
comparison 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 |
comparison
equal
deleted
inserted
replaced
393:9e2cbb2c2c64 | 394:346614f788f1 |
---|---|
14 glGetShaderInfoLog, glAttachShader, glLinkProgram, | 14 glGetShaderInfoLog, glAttachShader, glLinkProgram, |
15 glGetProgramiv, glGetProgramInfoLog, GL_LINK_STATUS, | 15 glGetProgramiv, glGetProgramInfoLog, GL_LINK_STATUS, |
16 glUseProgram, glGetUniformLocation, glUniform1f, | 16 glUseProgram, glGetUniformLocation, glUniform1f, |
17 glUniform2f, glUniform3f, glUniform4f, glUniform1i, | 17 glUniform2f, glUniform3f, glUniform4f, glUniform1i, |
18 glUniform2i, glUniform3i, glUniform4i, | 18 glUniform2i, glUniform3i, glUniform4i, |
19 glUniformMatrix4fv) | 19 glUniformMatrix4fv, glBindAttribLocation) |
20 | 20 |
21 from ctypes import (c_char, c_char_p, c_int, POINTER, byref, cast, | 21 from ctypes import (c_char, c_char_p, c_int, POINTER, byref, cast, |
22 create_string_buffer) | 22 create_string_buffer) |
23 | 23 |
24 | 24 |
40 | 40 |
41 # create the vertex shader | 41 # create the vertex shader |
42 self.createShader(vert, GL_VERTEX_SHADER) | 42 self.createShader(vert, GL_VERTEX_SHADER) |
43 # create the fragment shader | 43 # create the fragment shader |
44 self.createShader(frag, GL_FRAGMENT_SHADER) | 44 self.createShader(frag, GL_FRAGMENT_SHADER) |
45 | |
46 #TODO: put those elsewhere. | |
47 glBindAttribLocation(self.handle, 0, 'in_position') | |
48 glBindAttribLocation(self.handle, 1, 'in_texcoord') | |
49 glBindAttribLocation(self.handle, 2, 'in_color') | |
45 | 50 |
46 # attempt to link the program | 51 # attempt to link the program |
47 self.link() | 52 self.link() |
48 | 53 |
49 def load_source(self, path): | 54 def load_source(self, path): |