Commit dfa2c8a5 authored by Guillaume Poulin's avatar Guillaume Poulin
Browse files

solve some issue with opengl and python3

parent c02e6184
import OpenGL
from OpenGL import NullFunctionError
except ImportError:
from OpenGL.error import NullFunctionError
from OpenGL.GL import *
from OpenGL.GL import shaders
import re
......@@ -219,7 +222,7 @@ class Shader(object):
if self.compiled is None:
self.compiled = shaders.compileShader(self.code, self.shaderType)
except OpenGL.NullFunctionError:
except NullFunctionError:
raise Exception("This OpenGL implementation does not support shader programs; many features on pyqtgraph will not work.")
except RuntimeError as exc:
## Format compile errors a bit more nicely
......@@ -227,9 +230,12 @@ class Shader(object):
err, code, typ = exc.args
if not err.startswith('Shader compile failure'):
code = code[0].split('\n')
code = code[0].decode('utf_8').split('\n')
err, c, msgs = err.partition(':')
err = err + '\n'
msgs = re.sub('b\'','',msgs)
msgs = re.sub('\'$','',msgs)
msgs = re.sub('\\\\n','\n',msgs)
msgs = msgs.split('\n')
errNums = [()] * len(code)
for i, msg in enumerate(msgs):
......@@ -357,7 +363,7 @@ class ShaderProgram(object):
def uniform(self, name):
"""Return the location integer for a uniform variable in this program"""
return glGetUniformLocation(self.program(), bytes(name,'utf_8'))
return glGetUniformLocation(self.program(), name.encode('utf_8'))
#def uniformBlockInfo(self, blockName):
#blockIndex = glGetUniformBlockIndex(self.program(), blockName)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment