Re: [PyOpenGL-Users] Shader doesn't compile with Python 3
Brought to you by:
mcfletch
|
From: Stuart de M. <stu...@gm...> - 2013-05-06 20:06:34
|
Hello,
I came also across this issue, when using pyopengl 3.0.2 with python 3.3.0
, the following code
Shader = compileShader("""#version 330
in vec4 position;
void main()
{
gl_Position = position;
}""", GL_VERTEX_SHADER)
fShader = compileShader("""#version 330
out vec4 outputColor;
void main()
{
outputColor = vec4(1.0f, 1.0f, 1.0f, 1.0f);
}""", GL_FRAGMENT_SHADER)
generated the following error:
RuntimeError: ('Shader compile failure (0): b\'Vertex shader failed to
compile with the following errors:\\nERROR: 0:1: error(#132) Syntax error:
"b" parse error\\nERROR: error(#273) 1 compilation errors. No code
generated\\n\\n\'', [b'#version 330\n\nin vec4 position;\nvoid
main()\n{\n gl_Position = position;\n}'], GL_VERTEX_SHADER)
this was remedied by commenting out line 217 in shaders.py
def compileShader(source, shaderType):
"""Compile shader source of given type
source -- GLSL source-code for the shader
shaderType -- GLenum GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, etc,
returns GLuint compiled shader reference
raises RuntimeError when a compilation failure occurs
"""
if isinstance(source, str):
source = [ source ]
#source = [ as_bytes(s) for s in source ] # offending line
shader = glCreateShader(shaderType)
Hope this is of use,
Stuart
<http://sourceforge.net/mailarchive/forum.php?thread_name=CAD2qLTBocP8i2RjOcJsRDO48D1Gmi25fVt_T6hgO0gQP7cJhcw%40mail.gmail.com&forum_name=pyopengl-users>
|