Hello!
After learning Python for a while, I started experimenting with pyglet
and converting some projects from jogl.
And now I get some errors with the code for shaders. It seems it has
something to do with ctypes, but I haven't looked into them yet. And
they look pretty complicated.
Code:
vertex = glCreateShader(GL_VERTEX_SHADER)
fragment = glCreateShader(GL_FRAGMENT_SHADER)
vsource = 'void main()\n{\ngl_FrontColor = vec4(1.0, 1.0, 1.0,
1.0);\ngl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n}'
glShaderSource(vertex, 1, vsource, 0)
glCompileShader(vertex)
fsource = 'void main()\n{\ngl_FragColor = gl_Color;\n}'
glShaderSource(fragment, 1, fsource, 0)
glCompileShader(fragment)
self.program = glCreateProgram()
glAttachShader(self.program, vertex)
glAttachShader(self.program, fragment)
glLinkProgram(self.program)
glValidateProgram(self.program)
error:
glShaderSource(vertex, 1, vsource, 0)
ctypes.ArgumentError: argument 3: <type 'exceptions.TypeError'>:
expected LP_LP_c_char instance instead of str
definition:
glShaderSource = _link_function('glShaderSource', None, [GLuint,
GLsizei, POINTER(POINTER(GLchar)), POINTER(GLint)], 'VERSION_2_0')
How can I convert a str to LP_LP_c_char/POINTER(POINTER(GLchar))? (It
seems more like a ctypes question. :-( )
PS:
More advanced examples under http://pyglet.googlecode.com/svn/trunk/examples/
would be great!
(Shader, VBO, ...)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---