Home > other >  Using pyqtgraph and GLViewWidget draw 3 d scatterplot, additem times wrong openGL error
Using pyqtgraph and GLViewWidget draw 3 d scatterplot, additem times wrong openGL error

Time:04-01

Consult everybody a great god, and I am using pyqtgraph and GLViewWidget met openGL 3 d scatter plot error, the code is as follows:
 
G=gl. GLGridItem ()
Self. Guiplot. AddItem (g)

Pos=np. Random. The random (size=(100000, 3))
Pos *=[10, 10, 10]
Pos [0]=(0, 0, 0)
Color=np. 'ones ((pos) shape [0], 4))
D2=(pos * * 2). The sum (the axis=1) * * 0.5
Size=np. Random. The random (size=pos. Shape [0]) * 10
Sp2=gl. GLScatterPlotItem (pos=pos, color=(1, 1, 1, 1), size=size)
Self. Guiplot. AddItem (sp2)


When blocking sp2, can run normally and shows the grid g, but when the addItem (sp2), will be submitted to the following error:
 
Traceback (the most recent call last) :
The File "E: \ PycharmProject \ testPjt \ venv \ lib \ site - packages \ OpenGL \ latebind py", 43, line in __call__
Return self. _finalCall (* args, * * named)
TypeError: 'NoneType' object is not callable

During handling of the above exception, another exception occurred:

Traceback (the most recent call last) :
The File "E: \ PycharmProject \ testPjt \ venv \ lib \ site - packages \ pyqtgraph \ opengl \ GLViewWidget py", line 112, in addItem
Item. InitializeGL ()
The File "E: \ PycharmProject \ testPjt \ venv \ lib \ site - packages \ pyqtgraph \ opengl \ items \ GLScatterPlotItem py", line 74, in initializeGL
Self. PointTexture=glGenTextures (1)
The File "E: \ PycharmProject \ testPjt \ venv \ lib \ site - packages \ OpenGL \ latebind py", line 47, in __call__
Return self. _finalCall (* args, * * named)
The File "E: \ PycharmProject \ testPjt \ venv \ lib \ site - packages \ OpenGL \ wrapper py", line 678, in wrapperCall
Raise err
The File "E: \ PycharmProject \ testPjt \ venv \ lib \ site - packages \ OpenGL \ wrapper py", line 671, in wrapperCall
Result=wrappedOperation cArguments (*)
The File "E: \ PycharmProject \ testPjt \ venv \ lib \ site - packages \ OpenGL \ platform \ baseplatform py", line 415, in __call__
Return the self (* args, * * named)
The File "E: \ PycharmProject \ testPjt \ venv \ lib \ site - packages \ OpenGL \ error py", line 230, in glCheckError
Raise the self. _errorClass (
OpenGL. Error. GLError: GLError (
Err=1282,
Description=b '\ xce \ xde \ xd0 \ xa7 \ sets \ xd9 \ xd7 \ xf7',
BaseOperation=glGenTextures,
PyArgs=(
1,
),
CArgs=(1, array ([0], dtype=uint32)),
CArguments=(1, array ([0], dtype=uint32))
)

During handling of the above exception, another exception occurred:

Traceback (the most recent call last) :
The File "E: \ PycharmProject \ testPjt \ GUI py", line 165, in OnClickAction
Self. RunPlotWindow ()
The File "E: \ PycharmProject \ testPjt \ GUI py", line 160, in runPlotWindow
Self. ChildUI_NodeStatus=ChildWinNodeStatus ()
The File "E: \ PycharmProject \ testPjt \ ChildWinNodeStatus py", line 73, in __init__
Self. Guiplot. AddItem (sp2)
The File "E: \ PycharmProject \ testPjt \ venv \ lib \ site - packages \ pyqtgraph \ opengl \ GLViewWidget py", line 114, in addItem
Self. CheckOpenGLVersion (' Error while adding item % s to GLViewWidget. '% STR (item))
The File "E: \ PycharmProject \ testPjt \ venv \ lib \ site - packages \ pyqtgraph \ opengl \ GLViewWidget py", line 535, in checkOpenGLVersion
VerString=glGetString (GL_VERSION)
The File "E: \ PycharmProject \ testPjt \ venv \ lib \ site - packages \ OpenGL \ platform \ baseplatform py", line 415, in __call__
Return the self (* args, * * named)
The File "E: \ PycharmProject \ testPjt \ venv \ lib \ site - packages \ OpenGL \ error py", line 230, in glCheckError
Raise the self. _errorClass (
OpenGL. Error. GLError: GLError (
Err=1282,
Description=b '\ xce \ xde \ xd0 \ xa7 \ sets \ xd9 \ xd7 \ xf7',
BaseOperation=glGetString,
CArguments=(GL_VERSION,)
)


Seems to be the addItem (sp2), there is something wrong with initializeGL
 
If hasattr (item, 'initializeGL) :
Self. MakeCurrent ()
Try:
Item. InitializeGL ()
Except:
Self. CheckOpenGLVersion (' Error while adding item % s to GLViewWidget. '% STR (item))

For a great god ever encountered similar problems, how to solve? Thank you very much!
  • Related