@Chris yes, that's basically the issue. The function glShaderSource in py3 wants an 'str' object instead of a 'bytes' one. If you pass a 'bytes' you have to convert it to 'str'. And in the non-bzr version there is probably some code that doesn't correctly handles bytes strings.

I was able to solve the problem by backporting the function compileshader. In this way it works with both py2 and py3:

def compileShader( source, shaderType ):
    """Compile shader source of given type
source -- GLSL source-code for the shader
returns GLuint compiled shader reference
raises RuntimeError when a compilation failure occurs
    if isinstance(source, str):
        source = [source]
    elif isinstance(source, bytes):
        source = [source.decode('utf-8')]
    shader = glCreateShader(shaderType)
    glShaderSource(shader, source)
    result = glGetShaderiv(shader, GL_COMPILE_STATUS)
    if not(result):
        # TODO: this will be wrong if the user has
        # disabled traditional unpacking array support.
        raise RuntimeError(
            """Shader compile failure (%s): %s"""%(
                glGetShaderInfoLog( shader ),
    return shader

On Wed, May 29, 2013 at 9:23 AM, Chris Barker - NOAA Federal <chris.barker@noaa.gov> wrote:
On Tue, May 28, 2013 at 10:53 PM, Gabriele Lanaro
<gabriele.lanaro@gmail.com> wrote:
> I'm having the same problem in python 3 (not being able to compile the
> shaders because it gets an invalid literal). Did you find any actual
> workaround for that?

IIUC shaders have to be written in ASCII, perhaps with Py3, you are
passing unicode in -- ty encoding it to ascii and passing the bytes
object instead.

Or maybe I totally mis-understand the issue!



Christopher Barker, Ph.D.

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception