[PyOpenGL-Devel] [ pyopengl-Bugs-1953886 ] glutCreateMenu ctypes Argument Error
Brought to you by:
mcfletch
|
From: SourceForge.net <no...@so...> - 2008-05-02 14:59:17
|
Bugs item #1953886, was opened at 2008-04-29 01:00 Message generated for change (Comment added) made by mcfletch You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105988&aid=1953886&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: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Peter Barth (peterbarth) Assigned to: Nobody/Anonymous (nobody) Summary: glutCreateMenu ctypes Argument Error Initial Comment: With PyOpenGL-3.0.0-0.3.a6 on fedora 7 using glutCreateMenu gives a ctypes Argument Error. Similar problems on MacOs, not on Windows. Traceback (most recent call last): ... "/usr/lib/python2.5/site-packages/OpenGL/GLUT/special.py", line 165, in glutCreateMenu result = simple.glutCreateMenu( cCallback ) ctypes.ArgumentError: argument 1: <type 'exceptions.TypeError'>: expected CFunctionType instance instead of CFunctionType culprit seems to be in --- OpenGL/GLUT/special.py, 159 the definition of the callbackType callbackType = FUNCTION_TYPE( ctypes.c_int, ctypes.c_int ) used in glutCreateMenu, which conflicts with --- OpenGL/raw/GLUT/__init__.py, 118 argTypes=[FUNCTION_TYPE(None, c_int)], the conflicting lines appear to be in 3.0.0b1 as well. Fixing it with a module imported before any other PyOpenGL module --- # fixme import ctypes from OpenGL.raw import GLUT as simple MENUFUNC = ctypes.CFUNCTYPE(None, ctypes.c_int) def fixed_glutCreateMenu(menu_func): """replacement for broken glutCreateMenu""" menu = simple.glutCreateMenu(MENUFUNC(menu_func)) return menu # now replace existing version in OpenGL.GLUT import OpenGL.GLUT OpenGL.GLUT.glutCreateMenu = fixed_glutCreateMenu --- seems to work. ---------------------------------------------------------------------- >Comment By: Mike C. Fletcher (mcfletch) Date: 2008-05-02 10:59 Message: Logged In: YES user_id=34901 Originator: NO Seems the FreeGLUT header has a different spec than the GLUT header for the function. I've updated the type definition manually and it seems to work properly on a void return system using the int return value. Also fixed an error in recording the c-level callback object in context data. thanks. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105988&aid=1953886&group_id=5988 |