solve some issue with opengl and python3
This commit is contained in:
parent
c02e6184ef
commit
dfa2c8a502
@ -1,4 +1,7 @@
|
||||
import OpenGL
|
||||
try:
|
||||
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:
|
||||
try:
|
||||
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'):
|
||||
raise
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user