Re: [PyMOL] pyopengl broken?

2004-01-14 Thread Michael Banck
Did somebody (Warren?) look into this? Could anybody reproduce it (i.e.
running examples/devel/gl01.py)? Or is this just a problem on Debian
GNU/Linux?


thanks,

Michael

This was the text of the bug report:

--8--
On Fri, Oct 03, 2003 at 11:53:53AM +0200, Gabor E. Tusnady wrote:
   I would like to use pymol with python-opengl script. On my
   laptop I use
 pymol-0.86 width redhat 8.0. This package contains a lot of python
 example script, for example example/devel/gl01.py script. Running this
 script I have got a simple coordinate system displayed on the screen
 (the script is attached), while pymol reports:
 
 
  OpenGL based graphics front end:
   GL_VENDOR: Mesa project: www.mesa3d.org
   GL_RENDERER: Mesa GLX Indirect
   GL_VERSION: 1.3 Mesa 4.0.4
  Executive: object gl01 created.
 
 
   Using the debianized version of pymol-0.90 with debian-sid on my
 workstation, I have got the following error message:
 
 
  OpenGL based graphics front end:
   GL_VENDOR: NVIDIA Corporation
   GL_RENDERER: GeForce2 MX/AGP/SSE
   GL_VERSION: 1.4.0 NVIDIA 44.96
  Adapting to GeForce hardware...
   Detected 2 CPUs.  Enabled multithreaded rendering.
 Traceback (most recent call last):
   File /usr/lib/python2.3/site-packages/pymol/parser.py, line 203,
   in parse
 execfile(args[nest][0],pymol_names,pymol_names)
   File gl01.py, line 1, in ?
 from pymol.opengl.gl import *
   File /usr/lib/python2.3/site-packages/pymol/opengl/gl/__init__.py,
   line 32, 
 in ?
 import _opengl
 ImportError:
 /usr/lib/python2.3/site-packages/pymol/opengl/gl/_opengl.so: undefined
 symbol: 
 glTexGeniv
 
 
 I don't know whether I have not installed something, or it is a bug in
 the debianized pymol-0.90, or this error come from the NVIDIA opengl
 driver. 
 I'm really happy, if you can help me resolving this discrepancy.
 
 Gabor

--8--

On Sat, Oct 04, 2003 at 11:11:05PM +0200, Michael Banck wrote:
 Hi,
 
 I've got a bug on pyopengl (http://bugs.debian.org/214026). Seems the
 immeadiate fix is
 
 --- pymol-0.90.orig/setup.py
 +++ pymol-0.90/setup.py
 @@ -32,7 +32,7 @@
  else:
 inc_dirs=[layer0,layer1,layer2,layer3,layer4,layer5]
 libs=[GL,GLU,glut,png]
 -   pyogl_libs = []
 +   pyogl_libs = [GL,GLU,glut,png]
 lib_dirs=[/usr/X11R6/lib]
 def_macros=[(_PYMOL_MODULE,None),
  #  (_PYMOL_NUMPY,None),
 
 Is there a reason why these libraries are not defined in pyogl_libs?
 
 With that fix, examples/devel/gl01.py works fine. gl02.py gl03.py still
 fail though, with this error message:
 
  Executive: object gl02 created.
 Traceback (most recent call last):
   File gl02.py, line 39, in __call__
 glVertexPointer(3,0,self.vert)
 NameError: global name 'glVertexPointer' is not defined
 
 Digging a bit into contrib/pyopengl[1], I found that glVertexPointer
 will only get exported when NUMERIC is defined. As you can see from the
 patch above, _PYMOL_NUMPY is not defined and thus neither will be
 NUMERIC. If I uncomment that line above, I get this error while trying
 to build pymol:
 
 building 'pymol.opengl.glu._glu_num' extension
 gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes 
 -fPIC -D_PYMOL_MODULE -D_PYMOL_NUMPY -D_HAVE_LIBPNG -Ilayer0 -Ilayer1 
 -Ilayer2 -Ilayer3 -Ilayer4 -Ilayer5 -I/usr/include/python2.3 -c 
 contrib/pyopengl/_glu_nummodule.c -o 
 build/temp.linux-i686-2.3/contrib/pyopengl/_glu_nummodule.o
 In file included from contrib/pyopengl/_glu_nummodule.c:8:
 contrib/pyopengl/_glumodule.c:660:25: arrayobject.h: No such file or directory
 In file included from contrib/pyopengl/_glu_nummodule.c:8:
 contrib/pyopengl/_glumodule.c: In function `py_glu_Build2DMipmaps':
 contrib/pyopengl/_glumodule.c:737: error: `PyArrayObject' undeclared (first 
 use in this function)
 contrib/pyopengl/_glumodule.c:737: error: (Each undeclared identifier is 
 reported only once
 contrib/pyopengl/_glumodule.c:737: error: for each function it appears in.)
 contrib/pyopengl/_glumodule.c:737: error: `ap' undeclared (first use in this 
 function)
 contrib/pyopengl/_glumodule.c:754: warning: implicit declaration of function 
 `PyArray_Check'
 contrib/pyopengl/_glumodule.c:755: error: syntax error before ')' token
 contrib/pyopengl/_glumodule.c:758: error: syntax error before ')' token
 contrib/pyopengl/_glumodule.c: At top level:
 contrib/pyopengl/_glumodule.c:132: warning: `GLUquadricType' defined but not 
 used
 error: command 'gcc' failed with exit status 1
 make: *** [install] Error 1
 
 Finally, when I add HAVE_NUMERIC_ARRAYOBJECT_H to the defines in
 setup.py, pymol compiles fine[2] but gl02.py still fails:
 
  Executive: object gl02 created.
 Traceback (most recent call last):
   File gl02.py, line 39, in __call__
 glVertexPointer(3,0,self.vert)
 _opengl_num.error: Can't convert this type of array!
 
 That's where I stopped debugging stuff, can anybody help me?
 
 
 thanks,
 
 Michael
 
 [1] btw, is this the standard pyopengl module? Why is it shipped with
 

[PyMOL] pyopengl broken?

2003-10-04 Thread Michael Banck
Hi,

I've got a bug on pyopengl (http://bugs.debian.org/214026). Seems the
immeadiate fix is

--- pymol-0.90.orig/setup.py
+++ pymol-0.90/setup.py
@@ -32,7 +32,7 @@
 else:
inc_dirs=[layer0,layer1,layer2,layer3,layer4,layer5]
libs=[GL,GLU,glut,png]
-   pyogl_libs = []
+   pyogl_libs = [GL,GLU,glut,png]
lib_dirs=[/usr/X11R6/lib]
def_macros=[(_PYMOL_MODULE,None),
 #  (_PYMOL_NUMPY,None),

Is there a reason why these libraries are not defined in pyogl_libs?

With that fix, examples/devel/gl01.py works fine. gl02.py gl03.py still
fail though, with this error message:

 Executive: object gl02 created.
Traceback (most recent call last):
  File gl02.py, line 39, in __call__
glVertexPointer(3,0,self.vert)
NameError: global name 'glVertexPointer' is not defined

Digging a bit into contrib/pyopengl[1], I found that glVertexPointer
will only get exported when NUMERIC is defined. As you can see from the
patch above, _PYMOL_NUMPY is not defined and thus neither will be
NUMERIC. If I uncomment that line above, I get this error while trying
to build pymol:

building 'pymol.opengl.glu._glu_num' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes 
-fPIC -D_PYMOL_MODULE -D_PYMOL_NUMPY -D_HAVE_LIBPNG -Ilayer0 -Ilayer1 -Ilayer2 
-Ilayer3 -Ilayer4 -Ilayer5 -I/usr/include/python2.3 -c 
contrib/pyopengl/_glu_nummodule.c -o 
build/temp.linux-i686-2.3/contrib/pyopengl/_glu_nummodule.o
In file included from contrib/pyopengl/_glu_nummodule.c:8:
contrib/pyopengl/_glumodule.c:660:25: arrayobject.h: No such file or directory
In file included from contrib/pyopengl/_glu_nummodule.c:8:
contrib/pyopengl/_glumodule.c: In function `py_glu_Build2DMipmaps':
contrib/pyopengl/_glumodule.c:737: error: `PyArrayObject' undeclared (first use 
in this function)
contrib/pyopengl/_glumodule.c:737: error: (Each undeclared identifier is 
reported only once
contrib/pyopengl/_glumodule.c:737: error: for each function it appears in.)
contrib/pyopengl/_glumodule.c:737: error: `ap' undeclared (first use in this 
function)
contrib/pyopengl/_glumodule.c:754: warning: implicit declaration of function 
`PyArray_Check'
contrib/pyopengl/_glumodule.c:755: error: syntax error before ')' token
contrib/pyopengl/_glumodule.c:758: error: syntax error before ')' token
contrib/pyopengl/_glumodule.c: At top level:
contrib/pyopengl/_glumodule.c:132: warning: `GLUquadricType' defined but not 
used
error: command 'gcc' failed with exit status 1
make: *** [install] Error 1

Finally, when I add HAVE_NUMERIC_ARRAYOBJECT_H to the defines in
setup.py, pymol compiles fine[2] but gl02.py still fails:

 Executive: object gl02 created.
Traceback (most recent call last):
  File gl02.py, line 39, in __call__
glVertexPointer(3,0,self.vert)
_opengl_num.error: Can't convert this type of array!

That's where I stopped debugging stuff, can anybody help me?


thanks,

Michael

[1] btw, is this the standard pyopengl module? Why is it shipped with
pymol? If it's modified, can't the changes be sent upstream so that a
fork is not necessary? (I haven't checked at all, these thoughts just
occured to me now)

[2] when byte-compiling, I get this warning with python2.3:
/usr/lib/python2.3/site-packages/pymol/opengl/gl/glconst.py:438:
FutureWarning: hex/oct constants  sys.maxint will return positive
values in Python 2.4 and up
  GL_CLIENT_ALL_ATTRIB_BITS = 0x