Re: Shader doesn't compile with Python 3

Chris Barker - NOAA Federal <[email protected]> Mon, 15 Apr 2013 08:14:40 -0700
Newsgroups gmane.comp.python.opengl.user
Message-ID <-1078242932585994243@unknownmsgid>
I'm not using py3, but maybe you need to encode the string into a
bytes object ASCII.

-Chris
On Apr 14, 2013, at 1:44 PM, Matt Williams <[email protected]> wrote:

> 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
> _______________________________________________
> PyOpenGL-Users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pyopengl-users

------------------------------------------------------------------------------
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