Forum Archive

What am I doing wrong?

Cethric

I am working on OpenGLES bindings for pythonista and I keep having argument errors appear.
Here is the function raising the error

glShaderSource(GLuint(shader), GLsizei(1), str(source), GLint(0))

How it is setup

GLint = ctypes.c_int32
GLuint = ctypes.c_uint32
GLsizei = ctypes.c_int32

glShaderSource = c.glShaderSource
glShaderSource.restype = None
glShaderSource.argtypes = [GLuint, GLsizei, ctypes.c_char_p, GLint]

Which throws ArgumentError: argument 3: <'type.exceptions.TypeError'>: wrong type
Where am I going wrong?

JonB
void glShaderSource(    GLuint shader,
    GLsizei count,
    const GLchar **string,
    const GLint *length);

it appears that GLchar needs to be an array of string pointers.

So maybe something like (c_char_p * NumStrings) fir the argtype, and

mystrarray=(ctypes.c_char_p*NumStrings)()
mystrarray[0]=source
Cethric

That fixed the issue, thanks you @JonB