I ran gdb on the hello.py using Ubuntu 10.04 and intel graphic card
(There was no problem with the same computer in fedora 12.)

(gdb) r
Starting program: /usr/bin/python hello.py
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x004fb256 in glGetError () from /usr/lib/mesa/libGL.so.1
(gdb) bt
#0  0x004fb256 in glGetError () from /usr/lib/mesa/libGL.so.1
#1  0x0049301f in ffi_call_SYSV ()
   from /usr/lib/python2.6/lib-dynload/_ctypes.so
#2  0x00492e4c in ffi_call () from /usr/lib/python2.6/lib-dynload/_ctypes.so
#3  0x0048d48d in _CallProc () from /usr/lib/python2.6/lib-dynload/_ctypes.so
#4  0x00484e1e in ?? () from /usr/lib/python2.6/lib-dynload/_ctypes.so
#5  0x0806245a in PyObject_Call ()
#6  0x080e0471 in PyEval_EvalFrameEx ()
#7  0x080e2807 in PyEval_EvalCodeEx ()
#8  0x0816b2ac in ?? ()
#9  0x0806245a in PyObject_Call ()
#10 0x0806a45c in ?? ()
#11 0x08066573 in PyObject_CallFunctionObjArgs ()
#12 0x00484f4a in ?? () from /usr/lib/python2.6/lib-dynload/_ctypes.so
#13 0x0806245a in PyObject_Call ()
#14 0x080e0471 in PyEval_EvalFrameEx ()
#15 0x080e2807 in PyEval_EvalCodeEx ()
#16 0x080e2907 in PyEval_EvalCode ()
#17 0x081005ad in PyRun_FileExFlags ()
#18 0x08100812 in PyRun_SimpleFileExFlags ()
#19 0x0805de5c in Py_Main ()
#20 0x0805d03b in main ()

it seems that the intel driver doesn't handle very well the glGetError() 
called by glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)
because there was no context at this point.

but if we put a glCreateWindow("hello") just before glutInitDisplay
the program doesnt segfault anymore.


On 23 February 2011 17:22, Alejandro Segovia <asegovi@gmail.com> wrote:
Hello Duong,

On Wed, Feb 23, 2011 at 2:08 PM, Duong Dang <dang.duong@gmail.com> wrote:
On Wed, Feb 23, 2011 at 4:53 PM, Ian Mallett <geometrian@gmail.com> wrote:
> On Wed, Feb 23, 2011 at 8:38 AM, Alejandro Segovia <asegovi@gmail.com>
> wrote:
>> Hello Duong,
>> On Wed, Feb 23, 2011 at 11:55 AM, Duong Dang <dang.duong@gmail.com> wrote:
>>> Hello there,
>>> We are having a problem with PyOpenGL on a Ubuntu 10.04 machine with a
>>> Intel GMA945 graphics card. The following code works in C++, but its
>>> counterpart seg-faults in python. Any idea why that is?
>> I can't reproduce the problem on an NVIDIA video card,
> Nor I.

Thanks for testing, we also tried

which should be identical. The c program displays a white square just
fine but the python script seg faults again on the Intel card.
On another PC with a nvidia card, both programs work fine.

Do you have any other information on the crash? What OS are you running the script on? If you're on Linux, maybe you could record and inspect a valgrind dump. I don't know of any equivalent tools for Windows.


Alejandro Segovia Azapian
Director, Algorithmia: Visualization & Acceleration