The problem appears to have the same symptoms with 2.7 + PyOpenGL 3.1.0b1 - works without Optimus, crashes with Optimus.

I also ran the trace (Optimus, Python 2.7, PyOpenGL 3.1.0b1, file with single line "from OpenGL.GL import *"), the last couple of screens of which is:
http://pastebin.com/6gicFwsn
Let me know if you need more context than that.

Another thing to note is that the crash reporter seems to think the following libraries are involved in the crash:

/usr/local/lib/python2.7/dist-packages/OpenGL_accelerate/latebind.so
/usr/local/lib/python2.7/dist-packages/OpenGL_accelerate/errorchecker.so
/usr/local/lib/python2.7/dist-packages/OpenGL_accelerate/wrapper.so
/usr/local/lib/python2.7/dist-packages/OpenGL_accelerate/arraydatatype.so
/usr/local/lib/python2.7/dist-packages/OpenGL_accelerate/formathandler.so

I am unsure how accurate it is, as accelerate appears to be uninvolved in the issue - I ran the following file through five v's and trace:

import OpenGL
OpenGL.USE_ACCELERATE = False
from OpenGL.GL import *

and got the same result as with accelerate.

Regards,
Ákos Tóth


On 5 March 2014 06:10, Mike C. Fletcher <mcfletch@vrplumber.com> wrote:
On 14-03-03 05:09 PM, Ákos Tóth wrote:
Hi,

I recently started using pyOpenGL with Python 3.3 on Ubuntu 13.10. I am in the unfortunate situation of owning a laptop with a switchable (Optimus technology) dedicated video card. With the most recent version of pyOpenGL (3.1.0b1) installed, the program crashes quite seriously when running the line "from OpenGL.GL import *" - to the point where Ubuntu actually opens an error dialog for this. This problem is specific to Python 3 with optirun - in C++, OpenGL works on the optimus card without any hiccups, and version 3.0.2 with Python 2.7 also works without a problem.

Tests concluded so far:
- Python 2.7, pyOpenGL and accelerate version 3.0.2 with or without optirun. No problems.
- Python 3.3, pyOpenGL and accelerate version 3.1.0b1 without optirun - no problems but the intel card only supports openGL contexts up to version 3.1, which is far behind what I require.
- Python 3.3, pyOpenGL and accelerate version 3.1.0b1 with optirun, crash on import. In the pastebin link below is the output of python3 -vvvvvc "from OpenGL.GL import *".
Could you also test 2.7 + PyOpenGL 3.1.0b1 so we can see whether we have a problem with PyOpenGL 3.1 + Optimus or just with PyOpenGL 3.1 + Optimus + Python 3.x.  Testing PyOpenGL 3.1.0b1 without the Accelerate module on Python 2.7 would also help to narrow down failure cases.

If you could do a trace of the import to see what line fails, that would help.  To do that, create a file with just the import statement, then run:

    python -m trace --trace -f yourfile.py

it should print out each line as it executes and the last line printed should be the one that causes the crash.

The most likely cause of a crash is that we have something doing GL calls before there's a GL context.

Thanks,
Mike

--
________________________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://www.vrplumber.com
  http://blog.vrplumber.com