Re: Shader doesn't compile with Python 3
Stuart de Mowbray <[email protected]> Mon, 6 May 2013 21:06:26 +0100
| Newsgroups | gmane.comp.python.opengl.user |
|---|---|
| Message-ID | <CACJHPA4vN+nTGiH+9=rkuCHMV5Tiaj=P_rUiex_ziGk4eLf+Ag@mail.gmail.com> |
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>
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
PyOpenGL Homepage
http://pyopengl.sourceforge.net
_______________________________________________
PyOpenGL-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyopengl-users