omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    What am I doing wrong?

    Pythonista
    2
    3
    2329
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Cethric
      Cethric last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by 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
        
        1 Reply Last reply Reply Quote 0
        • Cethric
          Cethric last edited by

          That fixed the issue, thanks you @JonB

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB Forums | Contributors