pbfy0 / visvis

Automatically exported from code.google.com/p/visvis
Other
0 stars 0 forks source link

Access violations in polygonalModeling.py #77

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Getting intermittent access violations when generating meshes.  self._faces is 
a numpy  UINT32 array

 File "C:\Users\~\Python33\lib\site-packages\visvis\wobjects\polygonalModeling.py", line 1086, in _Draw
    gl.glDrawElements(type, N, face_dtype, self._faces)
  File "C:\Users\~\Python33\lib\site-packages\OpenGL\latebind.py", line 41, in __call__
    return self._finalCall( *args, **named )
  File "C:\Users\~\Python33\lib\site-packages\OpenGL\wrapper.py", line 765, in wrapperCall
    result = self.wrappedOperation( *cArguments )
OSError: exception: access violation reading 0xFFFFFFFC07536F1C

Have tried replacing "gl.glDrawElements(type, N, face_dtype, self._faces)" with 
"gl.glDrawElements(type, N, face_dtype, 
self._faces.ctypes.data_as(ctypes.POINTER(ctypes.c_long)))".  Seems to crash 
less on Windows 7, but no change on Windows XP.

I also tried using VBOs
            self.indexPositions.bind()
            self.vertexPositions.bind()
            gl.glEnableVertexAttribArray(0);
            gl.glVertexAttribPointer(0, 3, gl.GL_FLOAT, False, 0, None)
            gl.glDrawElements(type, N, face_dtype, None

Didn't seem to crash on Windows 7, but messes up visvis labels, shading, etc.

Windows 7:
Python 3.3.2
visvis 1.8
pyOpenGL 3.0.2
Graphic Adapter: Nivida Quadro 4000, driver 297.03

Also crashes in same way on two other Windows XP workstations with Nivida cards

Original issue reported on code.google.com by geith.gm...@gmail.com on 7 Oct 2013 at 5:54

GoogleCodeExporter commented 9 years ago
Just to be sure, this error occurs without any modifications to the code?

I suspect this is because of your mesh data. Are the faces zero-based indices? 
Perhaps you could send me an example mesh that crashes so I can try and 
reproduce?

Original comment by almar.klein@gmail.com on 9 Oct 2013 at 7:49

GoogleCodeExporter commented 9 years ago
Hi Alamar:

I made some modifications to the wx backend so I could use the new wx.Python 
Pheonix, however the problem occurs with other backends like pySide.

It is reproducible with  example_surfaceFromRandomPoints from the WIKI.

Procedure:  rotate each figure a few times and then stretch the frame window

I DID NOT see this issue under python 2.7 with its pyOpenGL lib

Question:  Is it safe to pass a numpy ndarray to glDrawElements as is being 
done in polygonalModeling.py", line 1086?  Elsewhere on the web most  code 
seems to use VBO.

Thanks for your help, might be a Python 3.3.2 or pyOpengl 3.0.2. Bug

Here's output:
  File "C:\Users\me\Python33\lib\site-packages\visvis\backends\qtcommon.py", line 211, in paintEvent
    self.figure.OnDraw()
  File "C:\Users\me\Python33\lib\site-packages\visvis\core\baseFigure.py", line 773, in OnDraw
    self._Draw(mode)
  File "C:\Users\me\Python33\lib\site-packages\visvis\core\baseFigure.py", line 860, in _Draw
    child._DrawTree(mode, pickerHelper)
  File "C:\Users\me\Python33\lib\site-packages\visvis\core\axes.py", line 123, in _DrawTree
    base.Wibject._DrawTree(self, mode, *args, **kwargs)
  File "C:\Users\me\Python33\lib\site-packages\visvis\core\base.py", line 191, in _DrawTree
    item._DrawTree(mode,pickerHelper)
  File "C:\Users\me\Python33\lib\site-packages\visvis\core\base.py", line 184, in _DrawTree
    self.OnDraw()
  File "C:\Users\me\Python33\lib\site-packages\visvis\core\axes.py", line 842, in OnDraw
    self._OnDrawInMode(DRAW_NORMAL, self.bgcolor)
  File "C:\Users\me\Python33\lib\site-packages\visvis\core\axes.py", line 902, in _OnDrawInMode
    self._OnDrawContent(mode, bgcolor, pos, pickerHelper)
  File "C:\Users\me\Python33\lib\site-packages\visvis\core\axes.py", line 1030, in _OnDrawContent
    item._DrawTree(mode, pickerHelper)
  File "C:\Users\me\Python33\lib\site-packages\visvis\core\base.py", line 184, in _DrawTree
    self.OnDraw()
  File "C:\Users\me\Python33\lib\site-packages\visvis\wobjects\polygonalModeling.py", line 926, in OnDraw
    self._Draw(self._edgeShading, self._edgeColor, self.edgeShader)
  File "C:\Users\me\Python33\lib\site-packages\visvis\wobjects\polygonalModeling.py", line 1086, in _Draw
    gl.glDrawElements(type, N, face_dtype, self._faces)
  File "C:\Users\me\Python33\lib\site-packages\OpenGL\latebind.py", line 41, in __call__
    return self._finalCall( *args, **named )
  File "C:\Users\me\Python33\lib\site-packages\OpenGL\wrapper.py", line 765, in wrapperCall
    result = self.wrappedOperation( *cArguments )
OSError: exception: access violation reading 0xFFFFFFFC06956F1C

Original comment by geith.gm...@gmail.com on 9 Oct 2013 at 3:55

GoogleCodeExporter commented 9 years ago
I cannot reproduce it. It sounds a bit like bad drivers to me. Can you try 
updating your video drivers, and installing the latest pyopengl?

> Question:  Is it safe to pass a numpy ndarray to glDrawElements as is being 
done in > polygonalModeling.py", line 1086?  Elsewhere on the web most  code 
seems to use VBO.

Yes, Pyopengl takes care of converting it to a pointer. VBO's are not used in 
visvis.

Original comment by almar.klein@gmail.com on 10 Oct 2013 at 7:49

GoogleCodeExporter commented 9 years ago
I upgraded the video driver for my Quadro 4000 to the latest driver version 
320.92.

I had the latest pyOpenGL 3.0.2 and it still had the access violation, I then 
tried pyOpenGL 3.1.0a1 and it still had the access violation.

I also sent a report to the pyOpenGL Users mailing list, no response yet.

I'm getting my libs from the UC Irvine site in California:
http://www.lfd.uci.edu/~gohlke/pythonlibs/

64-bit, python 3.3

I don't believe that should make a difference.  

Its probably a pyOpenGL issue with 3.3   :(

Original comment by geith.gm...@gmail.com on 10 Oct 2013 at 10:40

GoogleCodeExporter commented 9 years ago
Alamar:

I added the optional pyopengl_accelerate 3.0.2 module and the access violation 
seems to have gone away?!?

I'll post this to the pyOpenGL mailing list and see if I get any response.  Not 
sure if this cures all the problems over all my workstations, but seems stable 
so far ...

Original comment by geith.gm...@gmail.com on 10 Oct 2013 at 11:15