[ pyopengl-Bugs-2798902 ] crash glGetError

"SourceForge.net" <[email protected]> Sat, 18 Jul 2009 22:53:31 +0000
Newsgroups gmane.comp.python.opengl.devel
Message-ID <[email protected]>
Bugs item #2798902, was opened at 2009-05-30 14:06
Message generated for change (Comment added) made by mcfletch
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105988&aid=2798902&group_id=5988

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: GLUT
Group: v3.0.0
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Stephan Houben (stephanhouben)
Assigned to: Nobody/Anonymous (nobody)
Summary: crash glGetError

Initial Comment:
With PyOpenGL 3.0.0 and Python 2.6.2 (on x86),

the following simple file causes a crash:
=======================
from OpenGL.GLUT import *
glutInit()
glutInitDisplayMode(GLUT_RGB)
=======================

(gdb) run gltest.py
Starting program: /usr/local/bin/python gltest.py
[Thread debugging using libthread_db enabled]
[New Thread 0xb7da28d0 (LWP 1302)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7da28d0 (LWP 1302)]
0xb7c1b196 in glGetError () from /usr/lib/libGL.so.1
(gdb) where
#0  0xb7c1b196 in glGetError () from /usr/lib/libGL.so.1
#1  0xb7c91f67 in ffi_call_SYSV () at /home/stephanh/DOWNLOAD/Python-2.6.2/Modules/_ctypes/libffi/src/x86/sysv.S:61
#2  0xb7c91da6 in ffi_call (cif=0xbf87d9a8, fn=0xb7c1b190 <glGetError>, rvalue=0x0, avalue=0xbf87da20)
    at /home/stephanh/DOWNLOAD/Python-2.6.2/Modules/_ctypes/libffi/src/x86/ffi.c:213
#3  0xb7c8c4aa in _CallProc (pProc=0xb7c1b190 <glGetError>, argtuple=0xb7d6202c, flags=<value optimized out>, argtypes=0x0, 
    restype=0x86b85fc, checker=0x0) at /home/stephanh/DOWNLOAD/Python-2.6.2/Modules/_ctypes/callproc.c:815
#4  0xb7c83da9 in CFuncPtr_call (self=0x8700304, inargs=0xb7d6202c, kwds=0x0)
    at /home/stephanh/DOWNLOAD/Python-2.6.2/Modules/_ctypes/_ctypes.c:3857
#5  0x0805f6ca in PyObject_Call (func=0x8700304, arg=0xb7d6202c, kw=0x0) at Objects/abstract.c:2492
#6  0x080dacfa in PyEval_EvalFrameEx (f=0x87a6444, throwflag=0) at Python/ceval.c:3917
#7  0x080dddc8 in PyEval_EvalCodeEx (co=0x871d068, globals=0x870cdfc, locals=0x0, args=0xb7d507e0, argcount=4, kws=0x0, 
    kwcount=0, defs=0x871c6d8, defcount=2, closure=0x0) at Python/ceval.c:2968
#8  0x08131fef in function_call (func=0x8713df4, arg=0xb7d507d4, kw=0x0) at Objects/funcobject.c:524
#9  0x0805f6ca in PyObject_Call (func=0x8713df4, arg=0xb7d507d4, kw=0x0) at Objects/abstract.c:2492
#10 0x080665ca in instancemethod_call (func=0x8713df4, arg=0xb7d507d4, kw=0x0) at Objects/classobject.c:2579
#11 0x080640d1 in PyObject_CallFunctionObjArgs (callable=0xb7cd2dec) at Objects/abstract.c:2492
#12 0xb7c83de3 in CFuncPtr_call (self=0x876043c, inargs=0xb7d5232c, kwds=0x0)
    at /home/stephanh/DOWNLOAD/Python-2.6.2/Modules/_ctypes/_ctypes.c:3873
#13 0x0805f6ca in PyObject_Call (func=0x876043c, arg=0xb7d5232c, kw=0x0) at Objects/abstract.c:2492
#14 0x080dacfa in PyEval_EvalFrameEx (f=0x86a0f8c, throwflag=0) at Python/ceval.c:3917
#15 0x080dddc8 in PyEval_EvalCodeEx (co=0xb7d8f6e0, globals=0xb7d850b4, locals=0xb7d850b4, args=0x0, argcount=0, kws=0x0, 
    kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:2968
#16 0x080ddf27 in PyEval_EvalCode (co=0xb7d8f6e0, globals=0xb7d850b4, locals=0xb7d850b4) at Python/ceval.c:522
#17 0x080fbb01 in PyRun_FileExFlags (fp=0x8653cf8, filename=0xbf87f8f8 "gltest.py", start=257, globals=0xb7d850b4, 
    locals=0xb7d850b4, closeit=1, flags=0xbf87e718) at Python/pythonrun.c:1335
#18 0x080fbe5a in PyRun_SimpleFileExFlags (fp=0x8653cf8, filename=0xbf87f8f8 "gltest.py", closeit=1, flags=0xbf87e718)
    at Python/pythonrun.c:931
#19 0x0805ae42 in Py_Main (argc=1, argv=0xbf87e7e4) at Modules/main.c:599
#20 0x08059f32 in main (argc=-1081615896, argv=0xb7c91da6) at ./Modules/python.c:23

----------------------------------------------------------------------

>Comment By: Mike C. Fletcher (mcfletch)
Date: 2009-07-18 18:53

Message:
Thanks for the bug report, PyOpenGL 3.0.1 (current head) has fixed the
problem with the implicit calling of glGetError, which is no longer safe on
Linux platforms.

----------------------------------------------------------------------

Comment By: Stephan Houben (stephanhouben)
Date: 2009-05-31 09:33

Message:
Hi all,

Turns out the problem is caused by the implicit call to glGetError()
caused by glutInitDisplayMode() which is done before a window
is created.

Presumably, this means no OpenGL context is created either at this point.
If I do a glutCreateWindow() before glutInitDisplayMode() everything is
fine.

I am not sure if doing a glGetError before a GL context is created is
supposed to be legal.
If it is, the blame rests on the GL implementation (mesa) but otherwise it
is
bug in PyOpenGL. I think calling glutInitDisplayMode() before
glutCreateWindow()
is ordinarily an expected order.

Stephan

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105988&aid=2798902&group_id=5988

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
PyOpenGL Homepage
http://pyopengl.sourceforge.net