Re: Shader doesn't compile with Python 3

Matt Williams <[email protected]> Sun, 14 Apr 2013 21:43:40 +0100
Newsgroups gmane.comp.python.opengl.user
Message-ID <CAD2qLTAdWqOkRiyv6BaCc2wc9r=DmOwP-gsHkAcDNTaWEMonXw@mail.gmail.com>
On 14 April 2013 16:05, Ian Mallett <[email protected]> wrote:
> Pass it binary strings.

If I do that with:

VERTEX_SHADER = shaders.compileShader(b"""
    #version 130

    void main()
    {
    }
    """, GL_VERTEX_SHADER)

then it still works correctly on Python 2.7 but with Python 3.3 it errors with:

RuntimeError: ('Shader compile failure (0):\n0(1) : error C0125:
integer constant overflow\n0(1) : error C0000: syntax error,
unexpected unsigned integer constant at token "<uint-const>"\n', [10,
9, 35, 118, 101, 114, 115, 105, 111, 110, 32, 49, 51, 48, 10, 9, 10,
9, 118, 111, 105, 100, 32, 109, 97, 105, 110, 40, 41, 10, 9, 123, 10,
9, 125, 10, 9], GL_VERTEX_SHADER)

So it looks to be passing a list of integers referring to the correct
ASCII characters.

The Python source file itself is utf-8 encoded but since I'm only
using the ASCII range of characters, it's the same as if it were ASCII
encoded.

I have the same problem if I do:

VERTEX_SHADER = shaders.compileShader("""
    #version 130

    void main()
    {
    }
    """.encode('ascii'), GL_VERTEX_SHADER)

with an identical error.

Regards,
Matt Williams

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
PyOpenGL Homepage
http://pyopengl.sourceforge.net