Re: [PyOpenGL-Users] problem with soya's usage of OpenGL
Brought to you by:
mcfletch
From: Mike C. F. <mcf...@ro...> - 2004-07-19 23:00:20
|
We don't do anything particularly fancy in the wrapper for glGetString, here's what it looks like for the generated OpenGL 1.1 wrapper from PyOpenGL 2.0.1.08: static PyObject *_wrap_glGetString(PyObject *self, PyObject *args) { PyObject *resultobj; GLenum arg1 ; GLubyte *result; PyObject * obj0 = 0 ; if(!PyArg_ParseTuple(args,(char *)"O:glGetString",&obj0)) return NULL; arg1 = (GLenum) PyInt_AsLong(obj0); if (PyErr_Occurred()) return NULL; { result = (GLubyte *)glGetString(arg1); if (GLErrOccurred()) return NULL; } { if (result) { resultobj= PyString_FromString(result); } else { Py_INCREF(resultobj = Py_None); } } return resultobj; } I can't see anything there which is markedly different from your approach. PyOpenGL is fairly minimal wrt what it sets up for contexts. AFAIK we aren't doing anything funky with initialising our reference to OpenGL, leaving the context-creation work to the GUI libraries as much as possible, (though I should note that that stuff would all have been written by someone else, so it could be we spend thousands of lines of code on it somewhere and I've just missed it during maintenance). We do some minimal stuff such as defining functions for retrieving the current context under OpenGL 1.0, but I doubt that's relevant. From the docs: (http://pyopengl.sourceforge.net/documentation/manual/glGetString.3G.xml) GL_INVALID_OPERATION is generated if glGetString is executed between the execution of glBegin and the corresponding execution of glEnd. I'd confirm that you are not calling this within those functions. That and an invalid enum (feature-name) are the only two listed errors, and a 0 (NULL) return value apparently only occurs on error. Could your GLenum somehow be suffering from an off-by-one or similar error such that it's giving you lots of "invalid enum" errors across many parts of the API? Seems your check_gl_error() isn't picking up the failure for some reason, but that doesn't solve the base problem. Good luck, Mike ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://members.rogers.com/mcfletch/ blog: http://zope.vex.net/~mcfletch/plumbing/ |