pyopengl-users Mailing List for PyOpenGL (Page 65)
Brought to you by:
mcfletch
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(81) |
Oct
(41) |
Nov
(55) |
Dec
(14) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(34) |
Feb
(3) |
Mar
(16) |
Apr
(5) |
May
(10) |
Jun
(13) |
Jul
(24) |
Aug
(14) |
Sep
(14) |
Oct
(9) |
Nov
(10) |
Dec
(16) |
2003 |
Jan
(25) |
Feb
(59) |
Mar
(9) |
Apr
(21) |
May
(54) |
Jun
(4) |
Jul
(16) |
Aug
(19) |
Sep
(19) |
Oct
(15) |
Nov
(13) |
Dec
(22) |
2004 |
Jan
(19) |
Feb
(8) |
Mar
(20) |
Apr
(16) |
May
(13) |
Jun
(18) |
Jul
(18) |
Aug
(14) |
Sep
(24) |
Oct
(47) |
Nov
(20) |
Dec
(10) |
2005 |
Jan
(23) |
Feb
(31) |
Mar
(11) |
Apr
(29) |
May
(18) |
Jun
(7) |
Jul
(11) |
Aug
(12) |
Sep
(8) |
Oct
(4) |
Nov
(11) |
Dec
(7) |
2006 |
Jan
(7) |
Feb
(8) |
Mar
(15) |
Apr
(3) |
May
(8) |
Jun
(25) |
Jul
(19) |
Aug
(3) |
Sep
(17) |
Oct
(27) |
Nov
(24) |
Dec
(9) |
2007 |
Jan
(6) |
Feb
(43) |
Mar
(33) |
Apr
(8) |
May
(20) |
Jun
(11) |
Jul
(7) |
Aug
(8) |
Sep
(11) |
Oct
(22) |
Nov
(15) |
Dec
(18) |
2008 |
Jan
(14) |
Feb
(6) |
Mar
(6) |
Apr
(37) |
May
(13) |
Jun
(17) |
Jul
(22) |
Aug
(16) |
Sep
(14) |
Oct
(16) |
Nov
(29) |
Dec
(13) |
2009 |
Jan
(7) |
Feb
(25) |
Mar
(38) |
Apr
(57) |
May
(12) |
Jun
(32) |
Jul
(32) |
Aug
(35) |
Sep
(10) |
Oct
(28) |
Nov
(16) |
Dec
(49) |
2010 |
Jan
(57) |
Feb
(37) |
Mar
(22) |
Apr
(15) |
May
(45) |
Jun
(25) |
Jul
(32) |
Aug
(7) |
Sep
(13) |
Oct
(2) |
Nov
(11) |
Dec
(28) |
2011 |
Jan
(35) |
Feb
(39) |
Mar
|
Apr
(25) |
May
(32) |
Jun
(17) |
Jul
(29) |
Aug
(10) |
Sep
(26) |
Oct
(9) |
Nov
(28) |
Dec
(4) |
2012 |
Jan
(24) |
Feb
(47) |
Mar
(4) |
Apr
(8) |
May
(9) |
Jun
(6) |
Jul
(4) |
Aug
(1) |
Sep
(4) |
Oct
(28) |
Nov
(2) |
Dec
(2) |
2013 |
Jan
(11) |
Feb
(3) |
Mar
(4) |
Apr
(38) |
May
(15) |
Jun
(11) |
Jul
(15) |
Aug
(2) |
Sep
(2) |
Oct
(4) |
Nov
(3) |
Dec
(14) |
2014 |
Jan
(24) |
Feb
(31) |
Mar
(28) |
Apr
(16) |
May
(7) |
Jun
(6) |
Jul
(1) |
Aug
(10) |
Sep
(10) |
Oct
(2) |
Nov
|
Dec
|
2015 |
Jan
(6) |
Feb
(5) |
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
(2) |
Oct
(1) |
Nov
(19) |
Dec
|
2016 |
Jan
(6) |
Feb
(1) |
Mar
(7) |
Apr
|
May
(6) |
Jun
|
Jul
(3) |
Aug
(7) |
Sep
|
Oct
(2) |
Nov
(2) |
Dec
|
2017 |
Jan
|
Feb
(6) |
Mar
(8) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(4) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
|
2018 |
Jan
(9) |
Feb
(1) |
Mar
|
Apr
|
May
(1) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(6) |
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
(7) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Mike C. F. <mcf...@vr...> - 2007-12-16 17:39:03
|
David Bronke wrote: > I'm using GL_SELECT to select objects in my application, and I'm > getting some strange behavior. It seems that the selection buffer is > never reset, even though I am calling glRenderMode (GL_RENDER) after > selection, and am calling glSelectBuffer () before each selection. > Here's my code: ... > GL.glRenderMode (mode) That's the line that should reset the internal counter inside your OpenGL implementation that determines how many results should be returned: An internal index into buffer is reset to 0 whenever selection mode is entered. Each time a hit record is copied into buffer, the index is incremented to point to the cell just past the end of the block of names - that is, to the next available cell. If the hit record is larger than the number of remaining locations in buffer, as much data as can fit is copied, and the overflow flag is set. If the name stack is empty when a hit record is copied, that record consists of 0 followed by the minimum and maximum depth values. We do a little bit of custom code, but AFAICS we should not be able to influence the number of hits returned by the selection buffer (see OpenGL/GL/selection.py and OpenGL/GL/pointers.py for the actual code). That is, when you enter the mode the count should be reset. When you exit the mode it returns the internal count. The buffer remaining the same should *not* be a problem, incidentally, even if it were. We copy the reported number of records out of the buffer, and GL should be writing new records for every record it reports as having been copied in, so though there might be "garbage" at the end of the array, it should *not* affect your results or the number of them reported. > Any ideas what I'm doing wrong? It might be easiest to debug if you printed out the names of each element you are seeing in the buffer. Stop after the first few frames and check to see *how* those names are getting added. If you can disable the display-list usage (i.e. call the rendering code each time) you should be able to trace through and see each call to glPushName and glPopName. If you are not balancing those two you may be getting a run-away stack of names that are left on the stacks between runs. You could use an assert that GL_NAME_STACK_DEPTH is 0 to be sure you've done it, if you don't want to disable display lists. Good luck, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: David B. <whi...@gm...> - 2007-12-14 18:14:13
|
I'm using GL_SELECT to select objects in my application, and I'm getting some strange behavior. It seems that the selection buffer is never reset, even though I am calling glRenderMode (GL_RENDER) after selection, and am calling glSelectBuffer () before each selection. Here's my code: buffer = self.view.paintGL (GL.GL_SELECT, x, y) print "Selection returned %d hits:" % (len (buffer), ) where self.view.paintGL is defined as: def paintGL (self, mode = GL.GL_RENDER, pickX = 0, pickY = 0): # Initialize the rendering deleages. self.getGeometry () if mode == GL.GL_SELECT: # Set up the selection buffer. GL.glSelectBuffer (512) GL.glRenderMode (mode) # Initialize the name stack. GL.glInitNames () GL.glPushName (0) if self.useDisplayLists: # Call the display lists to set up drawing options and # transformation matrices. GL.glCallList (self.drawOptionsListId) GL.glCallList (self.windowTransformListId) GL.glCallList (self.userTransformListId) if mode == GL.GL_SELECT: # Save the current projection matrix. GL.glMatrixMode (GL.GL_PROJECTION) prevMatrix = GL.glGetDoublev (GL.GL_PROJECTION_MATRIX) # Set up the picking matrix. viewport = GL.glGetIntegerv (GL.GL_VIEWPORT) GL.glLoadIdentity () GLU.gluPickMatrix (pickX, pickY, 3, 3, viewport) GL.glMultMatrixd (prevMatrix) # Return to MODELVIEW matrix mode. GL.glMatrixMode (GL.GL_MODELVIEW) # Clear the view to the background color. self.qglClearColor (self.colorScheme.background) GL.glClear (GL.GL_COLOR_BUFFER_BIT) try: # Render the scene. for delegate in self.delegates: delegate.render () except GL.GLerror, inst: self.log ("ERROR", str (inst)) GL.glFlush () if mode == GL.GL_SELECT: # Restore the original projection matrix. GL.glMatrixMode (GL.GL_PROJECTION) GL.glLoadMatrix (prevMatrix) if mode != GL.GL_RENDER: # Exit selection or feedback mode, and return the # selection buffer or the feedback array. return GL.glRenderMode (GL.GL_RENDER) In the above code, self.useDisplayLists is True. And here's the output from clicking on the same object repeatedly: Selection returned 32 hits: Selection returned 34 hits: Selection returned 36 hits: Selection returned 38 hits: Selection returned 40 hits: <snip> Selection returned 122 hits: Selection returned 124 hits: Selection returned 126 hits: Selection returned 128 hits: Traceback (most recent call last): File "/home/whitelynx/gne/dbz/widgets/GL3DView.py", line 525, in mouseReleaseEvent handler.click (event.x (), event.y ()) File "/home/whitelynx/gne/dbz/widgets/ButtonHandlers.py", line 9, in click buffer = self.view.paintGL (GL.GL_SELECT, x, y) File "/home/whitelynx/gne/dbz/widgets/GL3DView.py", line 213, in paintGL return GL.glRenderMode (GL.GL_RENDER) OpenGL.GL.GLerror: [Errno (1283,)] glSelectBuffer too small to hold selection results Any ideas what I'm doing wrong? -- David H. Bronke Vice President of Project Development G33X Nexus Entertainment http://www.g33xnexus.com/ v3sw5/7Hhw5/6ln4pr6Ock3ma7u7+8Lw3/7Tm3l6+7Gi2e4t4Mb7Hen5g8+9ORPa22s6MSr7p6 hackerkey.com Support Web Standards! http://www.webstandards.org/ |
From: Darren W. <dar...@gm...> - 2007-12-07 07:14:01
|
I'm using PsychoPy that depends on pyOpenGL. I'm working on Ubuntu Gutsy (7.10, amd64) and see the traceback below. I've also found this or similar tracebacks with other python code that depends on pyOpenGL, so I hope this is the right place to ask about it. Some advice I've had suggests that libglut3 might be the source of this problem. As this is a python traceback (see below), I guess this is the logical place to look for bugs. Is this a problem with pyOpenGL? Thanks in advance, Darren dweber@skiweber:/data/psychophysics/psychopy$ ./first_stimulus.py Traceback (most recent call last): File "./first_stimulus.py", line 9, in <module> grating = visual.AlphaStim(win=mywin, mask="circle", size=3, pos=[-4,0], sf=3) File "/usr/lib/python2.5/site-packages/psychopy/visual.py", line 925, in __init__ self._setTex(tex) File "/usr/lib/python2.5/site-packages/psychopy/visual.py", line 1428, in _setTexNoShaders GL.glBindTexture(GL.GL_TEXTURE_1D, self.texID)#bind that name to the target ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: wrong type dweber@skiweber:/data/psychophysics/psychopy$ |
From: Arthur M. <art...@in...> - 2007-12-04 14:25:44
|
Hi, I have a nearly ten year old PII-266 with Cirrus Logic graphics card that runs the Python game "bouncy" under Debian unstable albeit very slowly. I tried running this on an AMD Duron machine with GForce3 Ti200 graphics card and the free "nv" X.org driver, and received the following error. The error persisted when using the "vesa" X.org driver. Any ideas? Package: bouncy Version: 0.6.20071104-1 Followup-For: Bug #453287 I upgraded to sid, and still received the same error: $ bouncy Traceback (most recent call last): File "game.py", line 8, in ? from OpenGL.GL import * File "/usr/lib/python2.4/site-packages/OpenGL/GL/__init__.py", line 2, in ? from OpenGL.raw.GL import * File "/usr/lib/python2.4/site-packages/OpenGL/raw/GL/__init__.py", line 6, in ? from OpenGL.raw.GL.constants import * File "/usr/lib/python2.4/site-packages/OpenGL/raw/GL/constants.py", line 7, in ? from OpenGL import platform, arrays File "/usr/lib/python2.4/site-packages/OpenGL/platform/__init__.py", line 24, in ? from OpenGL.platform.glx import * File "/usr/lib/python2.4/site-packages/OpenGL/platform/glx.py", line 29, in ? mode=ctypes.RTLD_GLOBAL File "/usr/lib/python2.4/site-packages/OpenGL/platform/ctypesloader.py", line 37, in loadLibrary return dllType( name, mode ) File "/usr/lib/python2.4/site-packages/ctypes/__init__.py", line 340, in __init__ self._handle = _dlopen(self._name, mode) OSError: GL: cannot open shared object file: No such file or directory # dpkg -l|grep -i gl|awk '{print $2 " " $3}' aptitude-doc-en 0.4.9-2 aspell-en 6.0-0-5.1 freeglut3 2.4.0-6 gcompris-sound-en 8.4.2-1 libdbus-glib-1-2 0.74-1 libgl1-mesa-dri 7.0.2-2 libgl1-mesa-glx 7.0.2-2 libgl1-mesa-swx11 7.0.2-2 libgl1-mesa-swx11-i686 7.0.2-2 libglib2.0-0 2.14.4-1 libglib2.0-data 2.14.4-1 libglu1-mesa 7.0.2-2 libtag1c2a 1.4-8+b1 python-opengl 3.0.0~a6-4 xserver-xorg-video-glint 1:1.1.1-8 grep -v \# xorg.conf |uniq Section "Files" EndSection Section "InputDevice" Identifier "Generic Keyboard" Driver "kbd" Option "CoreKeyboard" Option "XkbRules" "xorg" Option "XkbModel" "pc104" Option "XkbLayout" "us" EndSection Section "InputDevice" Identifier "Configured Mouse" Driver "mouse" Option "CorePointer" Option "Device" "/dev/input/mice" Option "Protocol" "ImPS/2" Option "Emulate3Buttons" "true" EndSection Section "Device" Identifier "nVidia Corporation NV20 [GeForce3 Ti 200]" Driver "nv" BusID "PCI:1:0:0" EndSection Section "Monitor" Identifier "Generic Monitor" Option "DPMS" EndSection Section "Screen" Identifier "Default Screen" Device "nVidia Corporation NV20 [GeForce3 Ti 200]" Monitor "Generic Monitor" DefaultDepth 24 SubSection "Display" Modes "1024x768" "832x624" "800x600" "720x400" "640x480" EndSubSection EndSection Section "ServerLayout" Identifier "Default Layout" Screen "Default Screen" InputDevice "Generic Keyboard" InputDevice "Configured Mouse" EndSection -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable') Architecture: i386 (i686) Kernel: Linux 2.6.22-3-k7 (SMP w/1 CPU core) Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages bouncy depends on: ii python 2.4.4-6 An interactive high-level object-o ii python-opengl 3.0.0~a6-4 Python bindings to OpenGL ii python-pygame 1.7.1release-4.1+b1 SDL bindings for games development ii ttf-bitstream-vera 1.10-7 The Bitstream Vera family of free bouncy recommends no packages. -- no debconf information |
From: Arthur M. <art...@in...> - 2007-12-04 13:40:22
|
Hi, I have a nearly ten year old PII-266 with Cirrus Logic graphics card that runs the Python game "bouncy" under Debian unstable albeit very slowly. I tried running this on an AMD Duron machine with GForce3 Ti200 graphics card and the free "nv" X.org driver, and received the following error. The error persisted when using the "vesa" X.org driver. Any ideas? Package: bouncy Version: 0.6.20071104-1 Followup-For: Bug #453287 I upgraded to sid, and still received the same error: $ bouncy Traceback (most recent call last): File "game.py", line 8, in ? from OpenGL.GL import * File "/usr/lib/python2.4/site-packages/OpenGL/GL/__init__.py", line 2, in ? from OpenGL.raw.GL import * File "/usr/lib/python2.4/site-packages/OpenGL/raw/GL/__init__.py", line 6, in ? from OpenGL.raw.GL.constants import * File "/usr/lib/python2.4/site-packages/OpenGL/raw/GL/constants.py", line 7, in ? from OpenGL import platform, arrays File "/usr/lib/python2.4/site-packages/OpenGL/platform/__init__.py", line 24, in ? from OpenGL.platform.glx import * File "/usr/lib/python2.4/site-packages/OpenGL/platform/glx.py", line 29, in ? mode=ctypes.RTLD_GLOBAL File "/usr/lib/python2.4/site-packages/OpenGL/platform/ctypesloader.py", line 37, in loadLibrary return dllType( name, mode ) File "/usr/lib/python2.4/site-packages/ctypes/__init__.py", line 340, in __init__ self._handle = _dlopen(self._name, mode) OSError: GL: cannot open shared object file: No such file or directory # dpkg -l|grep -i gl|awk '{print $2 " " $3}' aptitude-doc-en 0.4.9-2 aspell-en 6.0-0-5.1 freeglut3 2.4.0-6 gcompris-sound-en 8.4.2-1 libdbus-glib-1-2 0.74-1 libgl1-mesa-dri 7.0.2-2 libgl1-mesa-glx 7.0.2-2 libgl1-mesa-swx11 7.0.2-2 libgl1-mesa-swx11-i686 7.0.2-2 libglib2.0-0 2.14.4-1 libglib2.0-data 2.14.4-1 libglu1-mesa 7.0.2-2 libtag1c2a 1.4-8+b1 python-opengl 3.0.0~a6-4 xserver-xorg-video-glint 1:1.1.1-8 grep -v \# xorg.conf |uniq Section "Files" EndSection Section "InputDevice" Identifier "Generic Keyboard" Driver "kbd" Option "CoreKeyboard" Option "XkbRules" "xorg" Option "XkbModel" "pc104" Option "XkbLayout" "us" EndSection Section "InputDevice" Identifier "Configured Mouse" Driver "mouse" Option "CorePointer" Option "Device" "/dev/input/mice" Option "Protocol" "ImPS/2" Option "Emulate3Buttons" "true" EndSection Section "Device" Identifier "nVidia Corporation NV20 [GeForce3 Ti 200]" Driver "nv" BusID "PCI:1:0:0" EndSection Section "Monitor" Identifier "Generic Monitor" Option "DPMS" EndSection Section "Screen" Identifier "Default Screen" Device "nVidia Corporation NV20 [GeForce3 Ti 200]" Monitor "Generic Monitor" DefaultDepth 24 SubSection "Display" Modes "1024x768" "832x624" "800x600" "720x400" "640x480" EndSubSection EndSection Section "ServerLayout" Identifier "Default Layout" Screen "Default Screen" InputDevice "Generic Keyboard" InputDevice "Configured Mouse" EndSection -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable') Architecture: i386 (i686) Kernel: Linux 2.6.22-3-k7 (SMP w/1 CPU core) Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages bouncy depends on: ii python 2.4.4-6 An interactive high-level object-o ii python-opengl 3.0.0~a6-4 Python bindings to OpenGL ii python-pygame 1.7.1release-4.1+b1 SDL bindings for games development ii ttf-bitstream-vera 1.10-7 The Bitstream Vera family of free bouncy recommends no packages. -- no debconf information |
From: Greg E. <gre...@ca...> - 2007-11-28 01:32:31
|
duncan duncan wrote: > So what are the correct way ? Rotate the object or move the camera ? There isn't really any difference between these -- they're just two different ways of thinking about the same thing. If thinking in terms of rotating the object works for you, then there's nothing wrong with that. However, as you develop your application further, you may find it helpful to think of the object-to-camera transformation as consisting of two stages: 1) Transform from object to world coordinates 2) Transform from world to camera coordinates Then you can implement operations such as "move the object along the x axis" by changing the object-to-world part of the transformation, and not have to worry about what direction the x axis is pointing relative to the camera. Setting up such a 2-stage transformation would go something like glMatrixMode(GL_PROJECTION) glLoadIdentity() gluPerspective(...) # or gluOrtho for an orthographic projection glMatrixMode(GL_MODELVIEW) glLoadIdentity() gluLookAt(...) # Establish world-to-camera transform glMultMatrixd(object_to_world_transform) # Render object Note that gluLookAt is used on the modelview matrix, not the projection matrix. -- Greg |
From: duncan d. <dun...@gm...> - 2007-11-27 23:44:50
|
Hello. I am playing with pyopengl (and qt) and I have some problems. I am a newcomer to opengl and pyopengl. I am able to draw an object and rotato/zoom/move it. My problem now is that I'd like to draw the object in 4 viewport (no problem here) but with different point of view. Basically I am trying to draw the 3 basic orthogonal view (XY, XZ, YZ) and a perspective view. I am not interested in a 2D view for the orthogonal projections, since I will need the full 3D object anyway. Now I get this simply rotating the object around the axis as I need, but I am not sure this is the correct thing to do. Looking around it seems that the correct solution is to move the camera to have the correct point of view. So what are the correct way ? Rotate the object or move the camera ? And if the correct way is to move the camera, where I can find a simple example ? My idea is to make something like this: glMatrixMode(GL_PROJECTION) glLoadIdentity() glViewport(0, 0, w, h) gluLookAt(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ); glMatrixMode(GL_MODELVIEW) and then render my object but I cannot understand if this is correct and where I must do it. I suspect that I must do it in the display function, setting the values of the parameters for gluLookAt in some other places (I am thinking about the properties of the viewport) Is this the correct approach ? If not, where is my error ? thanks in advance Gianluca |
From: David M. <re...@or...> - 2007-11-26 18:53:18
|
Hi all, I've been developing a python app using the FLTK widgets (via pyFLTK). A critical part of the app is drawing video frames onto a GL window via glDrawPixels. (FLTK offers very basic support for GL windows, via its Fl_GL_Window class). At the moment, it's working nicely as long as I pass the pixels data in RGB format. But video editing works mainly with YCbCr format data, and converting the data into RGB format is very costly for CPU cycles - takes around 20ms on my 2GHz box. I've been told on #opengl that there is a way to set up an GL window so that if passed YCbCr data, it will display with correct colours. I'm a complete n00b with all things GL, I haven't got weeks to meditate on the Red Book etc. Is there a simple straightforward way via PyOpenGL to set up a GL window so that it can work with YCbCr data passed in via glDrawPixels? All help appreciated Cheers David |
From: duncan d. <dun...@gm...> - 2007-11-20 16:12:35
|
Hello to everyone. I am writing an application that should show the same object on multiple MDI windows (of a Qt Application), which are the classic orthogonal views. My idea is to have a common routine to draw the object on the 4 windows (every one has its own opengl view) and then set the viewport and/or the point of view to look at the object to see the correct orthogonal view (for 3 of them, the fourth is not a problem for now). Is this a good idea or there are other, more suitable, methods ? thanks in advance bye Gianluca |
From: altern <al...@gm...> - 2007-11-19 09:35:42
|
sorry, this was on windows XP with python 2.5 and pyopengl3.0.0a6-py2.5.egg altern(e)k dio: > hi > > I am porting an old app to the new PyOPenGL and I get an error at > > glRectfv( vlist[0], vlist[2] ) > > It says > > "wrappercall types.Argument.Error: ("argument 1: <type > 'exceptions.TypeError'>: byref() argument must be ctypes instance, not > 'tuple', [(-5.5, -5.5), <OpenGL.arrays.listsc_floatArray_2 object at > 0x02x10210>])" > > my bet is that this is a bug because I can replace it by > > glBegin(GL_QUADS) > glVertex2fv( vlist[0] ) > glVertex2fv( vlist[1] ) > glVertex2fv( vlist[2] ) > glVertex2fv( vlist[3] ) > glEnd() > > and this draws the rect with no errors at all. > > enrike > |
From: altern <al...@gm...> - 2007-11-19 09:34:21
|
hi I am porting an old app to the new PyOPenGL and I get an error at glRectfv( vlist[0], vlist[2] ) It says "wrappercall types.Argument.Error: ("argument 1: <type 'exceptions.TypeError'>: byref() argument must be ctypes instance, not 'tuple', [(-5.5, -5.5), <OpenGL.arrays.listsc_floatArray_2 object at 0x02x10210>])" my bet is that this is a bug because I can replace it by glBegin(GL_QUADS) glVertex2fv( vlist[0] ) glVertex2fv( vlist[1] ) glVertex2fv( vlist[2] ) glVertex2fv( vlist[3] ) glEnd() and this draws the rect with no errors at all. enrike |
From: altern <al...@gm...> - 2007-11-16 08:59:28
|
btw. the py2exeeggs.py trick did not work for me, this is why i did this enrike altern(e)k dio: > hi > > i have been trying different ways to get py2exe to create a standalone. > Py2exe seems to have problems with the eggs. This is how i got it to > work, but I would like to hear if there is some better way to do it. > > first i need to include this at the top of the python file i want to > make standalone. > sys.path.insert(0, os.path.join(sys.prefix, "PyOpenglxxxxxx.egg")) > sys.path.insert(0, os.path.join(sys.prefix, "setuptoolsxxxxxx.egg")) > > with the right name of the pyopengl and setuptools eggs at site-pakcages > > then I run the setup.py : > $ python setup.py p2exe -e OpenGL -i > ctypes,ctypes.util,weakref,new,distutils.util,logging > > then I must manually copy the PyOpenGL and setuptools eggs to the > dist/lib folder in the distribution. > > only after this it does work as standalone. Anyone knows a better solution? > > thanks! > > enrike > |
From: altern <al...@gm...> - 2007-11-15 14:32:15
|
hi i have been trying different ways to get py2exe to create a standalone. Py2exe seems to have problems with the eggs. This is how i got it to work, but I would like to hear if there is some better way to do it. first i need to include this at the top of the python file i want to make standalone. sys.path.insert(0, os.path.join(sys.prefix, "PyOpenglxxxxxx.egg")) sys.path.insert(0, os.path.join(sys.prefix, "setuptoolsxxxxxx.egg")) with the right name of the pyopengl and setuptools eggs at site-pakcages then I run the setup.py : $ python setup.py p2exe -e OpenGL -i ctypes,ctypes.util,weakref,new,distutils.util,logging then I must manually copy the PyOpenGL and setuptools eggs to the dist/lib folder in the distribution. only after this it does work as standalone. Anyone knows a better solution? thanks! enrike |
From: Black <py...@bl...> - 2007-11-13 17:46:42
|
It looks like you are generally on the right path, though your probably did want to do the selection on mouse down rather than up.. The error is a misleading one because it has nothing to do with your ability to select things. Quite simply, you are trying to return a list that doesn't exist. The function processBuffer is the only place that self.selected appears, and you never explicitly make it. If you just put a self.selected = [] in your init function, your error will go away. You still won't be able to select things because you have some error in your rendering that I haven't taken the time to track down - but that should get you past this particular error... On Nov 13, 2007, at 11:57 AM, duncan duncan wrote: > Hello > > I am playing with python and pyopengl. > I have not any problem to draw the object and so on, but then I'd like > to select an already drawn object. > > The code is attached > > Running it I get this error: > > --------- pick3d ---------- > - nhits = 0 > hit nothing > - selectedObjects: > Traceback (most recent call last): > File "C:\software_personale\openboat\code_snippets\hellogl.py", line > 143, in mouseReleaseEvent > self.pick3d(event) > File "C:\software_personale\openboat\code_snippets\hellogl.py", line > 257, in pick3d > return self.processBuffer() > File "C:\software_personale\openboat\code_snippets\hellogl.py", line > 274, in processBuffer > print " - selectedObjects: ", self.selected > AttributeError: selected > > > As you can see, the function is called in the mouseReleaseEvent (O > also tried the mousePressEvent) > Any idea (or link) on how I can select an object ? My goal is to be > able to select a point and drag it around the viewport, > beeing able to get the new position > > Any hints ? > > thanks in advance > bye > Gianluca<hellogl.py>-------------------------------------------------- > ----------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a > browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > PyOpenGL Homepage > http://pyopengl.sourceforge.net > _______________________________________________ > PyOpenGL-Users mailing list > PyO...@li... > https://lists.sourceforge.net/lists/listinfo/pyopengl-users |
From: altern <al...@gm...> - 2007-11-13 17:23:38
|
hi My old py2exe script to create standlone PyOpenGL apps has stoped working since I started using pyopengl3. As far as I can see the reason is that it is installed as an egg and not as a directory. My bet was that I had to exclude OpenGL and manually uncompress the egg and copy the OpenGL folder to the standalone dist folder but this did not work for me. Is there an example or documentation I could check? I have been trying to find how to do this, I saw some posts in the list, but I think it would be good to have a simple and clear recipe of how to deal with this. I would be happy to produce it, if I find the solution. thanks! enrike |
From: duncan d. <dun...@gm...> - 2007-11-13 16:58:02
|
Hello I am playing with python and pyopengl. I have not any problem to draw the object and so on, but then I'd like to select an already drawn object. The code is attached Running it I get this error: --------- pick3d ---------- - nhits = 0 hit nothing - selectedObjects: Traceback (most recent call last): File "C:\software_personale\openboat\code_snippets\hellogl.py", line 143, in mouseReleaseEvent self.pick3d(event) File "C:\software_personale\openboat\code_snippets\hellogl.py", line 257, in pick3d return self.processBuffer() File "C:\software_personale\openboat\code_snippets\hellogl.py", line 274, in processBuffer print " - selectedObjects: ", self.selected AttributeError: selected As you can see, the function is called in the mouseReleaseEvent (O also tried the mousePressEvent) Any idea (or link) on how I can select an object ? My goal is to be able to select a point and drag it around the viewport, beeing able to get the new position Any hints ? thanks in advance bye Gianluca |
From: JoN <jo...@we...> - 2007-11-09 04:14:26
|
Quoting "Mike C. Fletcher" <mcf...@vr...>: > Actually, ctypes is quite slow compared to e.g. SWIG. That's because it > does a lot more work at run-time for every call than a SWIG or similar > system does. OpenGL-ctypes (PyOpenGL) is even slower because it has to > provide the array and similar semantics that aren't available in ctypes' > core. > Good gods, is this still the case? Jon > Have fun, > Mike > > -- > ________________________________________________ > Mike C. Fletcher > Designer, VR Plumber, Coder > http://www.vrplumber.com > http://blog.vrplumber.com > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > PyOpenGL Homepage > http://pyopengl.sourceforge.net > _______________________________________________ > PyOpenGL-Users mailing list > PyO...@li... > https://lists.sourceforge.net/lists/listinfo/pyopengl-users > -------------------------------------------------------------------- Come and visit Web Prophets Website at http://www.webprophets.net.au |
From: JoN <jo...@we...> - 2007-11-09 04:12:58
|
This really is a low-traffic list isn't it. :) Quoting JoN <jo...@we...>: > > I have a similar problem in an identical environment. > > Python 2.5.1 > PyOpenGL-3.0.0a6 > PyOpenGL-Demo-3.0.0a6 > > Windows XP SP2 (Actually, come to think of it....I had no problems before > SP2!) > > > If I run lesson6.py from the NeHe demos (actually it happens on other progs > including ones I wrote myself that used to work), I get: > > C:\Python25\Lib\site-packages\PyOpenGL_Demo-3.0.0a6-py2.5.egg\PyOpenGL-Demo\NeHe > >lesson6.py > Hit ESC key to quit. > Traceback (most recent call last): > File "build\bdist.win32\egg\OpenGL\GLUT\special.py", line 107, in safeCall > return function( *args, **named ) > File > "C:\Python25\Lib\site-packages\PyOpenGL_Demo-3.0.0a6-py2.5.egg\PyOpenGL-D > emo\NeHe\lesson6.py", line 117, in DrawGLScene > glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) # Clear The Screen > And T > he Depth Buffer > File "build\bdist.win32\egg\OpenGL\error.py", line 188, in glCheckError > baseOperation = baseOperation, > GLError: GLError( > err = 1285, > description = 'out of memory', > baseOperation = glClear, > cArguments = (16640,) > ) > GLUT callback forcing low-level exit on error: GLError( > err = 1285, > description = 'out of memory', > baseOperation = glClear, > cArguments = (16640,) > ) > > C:\Python25\Lib\site-packages\PyOpenGL_Demo-3.0.0a6-py2.5.egg\PyOpenGL-Demo\NeHe > > > > > Any clues? Mike? Anybody? > > > Best Regs > Jon > > > > > > Quoting altern <al...@gm...> > > > hi > > > > just upgraded to python 2.5 and pyopengl 3.0.0a6 under XP. Any solutions > > to this problem? > > > > > http://sourceforge.net/mailarchive/message.php?msg_id=464D0AF5.2080303%40vrplumber.com > > > > I double checked and glut32.dll was installed in c:\windows\system32 > > > > thanks > > > > enrike > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. > > Still grepping through log files to find problems? Stop. > > Now Search log events and configuration files using AJAX and a browser. > > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > _______________________________________________ > > PyOpenGL Homepage > > http://pyopengl.sourceforge.net > > _______________________________________________ > > PyOpenGL-Users mailing list > > PyO...@li... > > https://lists.sourceforge.net/lists/listinfo/pyopengl-users > > > > > > > -------------------------------------------------------------------- > Come and visit Web Prophets Website at http://www.webprophets.net.au > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > PyOpenGL Homepage > http://pyopengl.sourceforge.net > _______________________________________________ > PyOpenGL-Users mailing list > PyO...@li... > https://lists.sourceforge.net/lists/listinfo/pyopengl-users > -------------------------------------------------------------------- Come and visit Web Prophets Website at http://www.webprophets.net.au |
From: JoN <jo...@we...> - 2007-11-05 11:20:37
|
I have a similar problem in an identical environment. Python 2.5.1 PyOpenGL-3.0.0a6 PyOpenGL-Demo-3.0.0a6 Windows XP SP2 (Actually, come to think of it....I had no problems before SP2!) If I run lesson6.py from the NeHe demos (actually it happens on other progs including ones I wrote myself that used to work), I get: C:\Python25\Lib\site-packages\PyOpenGL_Demo-3.0.0a6-py2.5.egg\PyOpenGL-Demo\NeHe >lesson6.py Hit ESC key to quit. Traceback (most recent call last): File "build\bdist.win32\egg\OpenGL\GLUT\special.py", line 107, in safeCall return function( *args, **named ) File "C:\Python25\Lib\site-packages\PyOpenGL_Demo-3.0.0a6-py2.5.egg\PyOpenGL-D emo\NeHe\lesson6.py", line 117, in DrawGLScene glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) # Clear The Screen And T he Depth Buffer File "build\bdist.win32\egg\OpenGL\error.py", line 188, in glCheckError baseOperation = baseOperation, GLError: GLError( err = 1285, description = 'out of memory', baseOperation = glClear, cArguments = (16640,) ) GLUT callback forcing low-level exit on error: GLError( err = 1285, description = 'out of memory', baseOperation = glClear, cArguments = (16640,) ) C:\Python25\Lib\site-packages\PyOpenGL_Demo-3.0.0a6-py2.5.egg\PyOpenGL-Demo\NeHe > Any clues? Mike? Anybody? Best Regs Jon Quoting altern <al...@gm...> > hi > > just upgraded to python 2.5 and pyopengl 3.0.0a6 under XP. Any solutions > to this problem? > > http://sourceforge.net/mailarchive/message.php?msg_id=464D0AF5.2080303%40vrplumber.com > > I double checked and glut32.dll was installed in c:\windows\system32 > > thanks > > enrike > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > PyOpenGL Homepage > http://pyopengl.sourceforge.net > _______________________________________________ > PyOpenGL-Users mailing list > PyO...@li... > https://lists.sourceforge.net/lists/listinfo/pyopengl-users > -------------------------------------------------------------------- Come and visit Web Prophets Website at http://www.webprophets.net.au |
From: Gabriel H. <gas...@ya...> - 2007-11-03 03:39:02
|
I was not able to Install the PyOpenGL package despite the deceiving name used for the script easy_install . OK, when I run from Windows XP Pro, no service pack, command Prompt: C:\Python24\Scripts>easy_install-2.4.exe PyOpenGL the following message is shown. Searching for PyOpenGL Best match: PyOpenGL 3.0.0a6 Processing pyopengl-3.0.0a6-py2.4.egg pyopengl 3.0.0a6 is already the active version Using c:\python24\lib\site-packages\pyopengl-3 Processing dependencies for PyOpenGL and the package, I verify at: C:\Python24\Lib\site-packages , is not installed. Any suggestions? __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Mike C. F. <mcf...@vr...> - 2007-10-27 19:15:38
|
Jerome Fuselier wrote: > Hello, > I tried to use the glXCreatePixmap method from the GLX package of > PyOpenGL but I'm stucked with the needed parameters and don't really > find some examples on how to use the python binding. Your "Xlib" library may have some way of retrieving the display, configuration and pixmap pointers (the underlying X pointers, not the Python objects). It will likely return those as integers, and those values can be passed to the function. Hope that helps, Mike > >>> from Xlib.display import Display > >>> from OpenGL.GLX import * > >>> d = Display() > >>> root = d.screen().root > >>> pixmap = root.create_pixmap(256, 256, 8) > >>> glXCreateWindow(d, cfg, pixmap, 0) -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: Jerome F. <jer...@fr...> - 2007-10-26 15:20:55
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body bgcolor="#ffffff" text="#3333ff"> Hello,<br> I tried to use the glXCreatePixmap method from the GLX package of PyOpenGL but I'm stucked with the needed parameters and don't really find some examples on how to use the python binding.<br> <br> I tried to adapt a C code to python but it fails.<br> <br> I wanted to do something like that :<br> <br> >>> from Xlib.display import Display<br> >>> from OpenGL.GLX import *<br> >>> d = Display()<br> >>> root = d.screen().root<br> >>> pixmap = root.create_pixmap(256, 256, 8)<br> >>> glXCreateWindow(d, cfg, pixmap, 0)<tt><br> </tt><br> But I got an error like "argument 1: exceptions.TypeError: expected LP__XDisplay instance instead of instance". I dn't know how I can get the needed pointer as I am in python.<br> <br> I just don't manage to find a good example of how to use the binding :(<br> <br> Would anyone have some simple scripts I could have a look at to understand how it works ?<br> <br> The final problem I'm trying to solve is the creation of a bitmap from a specific window of my x server, to incorporate it as the texture of an object of a 3D scene, if possible in real-time...<br> <br> <br> If you have some hints to help me it would be great.<br> <br> Thanks,<br> Jérôme<br> <tt></tt> </body> </html> |
From: <sh...@lo...> - 2007-10-23 01:34:25
|
Hi again, I think I may have fixed my earlier error by changing my Python path (again), but now I get another error. Again, this software works on a different Linux system, but I'm having trouble with it on this one. Does anyone have any ideas for me? Thanks again! Shari Here is the error message: ============================================ Traceback (most recent call last): File "/home/shari/workspace/VisualizationGallery20071022/src/gui/wxGui.py", line 72, in <module> vizApp = VizApp() File "/home/shari/workspace/VisualizationGallery20071022/src/gui/wxGui.py", line 10, in __init__ wx.App.__init__(self, redirect=False) File "/usr/lib/python2.5/site-packages/wx-2.8-gtk2-ansi/wx/_core.py", line 7818, in __init__ self._BootstrapApp() File "/usr/lib/python2.5/site-packages/wx-2.8-gtk2-ansi/wx/_core.py", line 7415, in _BootstrapApp return _core_.PyApp__BootstrapApp(*args, **kwargs) File "/home/shari/workspace/VisualizationGallery20071022/src/gui/wxGui.py", line 33, in OnInit self.win = mainWindow.mainWindow(frame) File "/home/shari/workspace/VisualizationGallery20071022/src/gui/mainWindow.py", line 30, in __init__ self.navigationWin.setPosition(navigationWindow.Position(0, 0)) File "/home/shari/workspace/VisualizationGallery20071022/src/gui/navigationWindow.py", line 163, in setPosition self.gallery.LookAt(self.position.x, self.position.z) File "/home/shari/workspace/VisualizationGallery20071022/src/gui/gallery.py", line 145, in LookAt billboardX, billboardY, billboardZ) File "/home/shari/workspace/VisualizationGallery20071022/src/gui/gallery.py", line 130, in SetPosition self.OnDraw() File "/home/shari/workspace/VisualizationGallery20071022/src/gui/gallery.py", line 115, in OnDraw glCallList(self.billboardList) File "build/bdist.linux-i686/egg/OpenGL/error.py", line 188, in glCheckError OpenGL.error.GLError: GLError( err = 1281, description = 'invalid value', baseOperation = glCallList, cArguments = (1L,) ) ============================================ And here is the offending class: ============================================ #!/usr/bin/env python2.4 import wx import os import Image import glMethods import wx.lib.scrolledpanel as scrolled import wx.lib.statbmp as statbmp import wx.lib.buttons as buttons from wx import glcanvas from vtk.wx.wxVTKRenderWindow import * from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * import vizGenerator.vizEngine MAP_FILE_NAME = "/home/shari/thesisFiles/testSet.cod" DATA_FILE_NAME = "/home/shari/thesisFiles/schoolData.vtk" MAX_HISTORY_SIZE = 1000 class myGLWindow(glcanvas.GLCanvas): def __init__(self, parent): glcanvas.GLCanvas.__init__(self, parent, -1) print "In myGLWindow.__init__" self.init = False # initial mouse position self.lastx = self.x = 30 self.lasty = self.y = 30 self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) self.Bind(wx.EVT_SIZE, self.OnSize) self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_LEFT_DOWN, self.OnMouseDown) self.Bind(wx.EVT_LEFT_UP, self.OnMouseUp) self.Bind(wx.EVT_MOTION, self.OnMouseMotion) self.InitGL() def OnEraseBackground(self, event): pass # Do nothing, to avoid flashing on MSW. def OnSize(self, event): print "In myGLWindow.OnSize" self.SetCurrent() size = self.GetClientSize() if self.GetContext(): self.SetCurrent() if (True): if (size.height == 0): size.height = 1 # prevent divide by 0 glViewport(0, 0, size.width, size.height) glMatrixMode(GL_PROJECTION) glLoadIdentity() # Calculate the aspect ratio of the window # gluPerspective(80.0, float(size.width) / float(size.height), # 1.0, 50.0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() #self.SwapBuffers() self.OnDraw() event.Skip() def OnPaint(self, event): dc = wx.PaintDC(self) self.SetCurrent() if not self.init: self.InitGL() self.init = True self.OnDraw() def OnMouseDown(self, evt): self.CaptureMouse() def OnMouseUp(self, evt): self.ReleaseMouse() def OnMouseMotion(self, evt): if evt.Dragging() and evt.LeftIsDown(): self.x, self.y = self.lastx, self.lasty self.x, self.y = evt.GetPosition() self.Refresh(False) class Gallery(myGLWindow): vizImageIds = [] #global myVizEngine xMapSize = 0 yMapSize = 0 width = 1.0 # Length of a billboard height = 1.0 # Height of a billboard distX = 1.0 # Distance between billboards in the x direction distZ = 1.5 # Distance between billboards in the z direction myVizEngine = vizGenerator.vizEngine.vizEngine(MAP_FILE_NAME, DATA_FILE_NAME) xMapSize = int(myVizEngine.mapMatrix.sizeX) yMapSize = int(myVizEngine.mapMatrix.sizeY) billboardList = 0 def getVizEngine(self): return self.myVizEngine def OnDraw(self): print "In Gallery.OnDraw" self.SetCurrent() glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glCallList(self.billboardList) glFlush() self.SwapBuffers() def SetPosition(self, camX, camY, camZ, viewX, viewY, viewZ): """Sets the viewpoint at which to look Called when the user moves from one location to another""" print "In Gallery.SetPosition" self.SetCurrent() # Viewing transformation glLoadIdentity() gluLookAt(camX, camY, camZ, # camera position viewX, viewY, viewZ , # camera aimed at 0.0, 1.0, 0.0) # view-up matrix self.OnDraw() #self.SwapBuffers() def LookAt(self, x, z): """Positions the camera and viewpoint to look at the billboard at array position (x, z)""" print "Looking at position: ", x, z self.SetCurrent() billboardX = x * (self.distX + self.width) + self.width / 2 billboardY = 0.5 billboardZ = (z - 1) * self.distZ camX = billboardX camY = billboardY camZ = billboardZ - (self.distZ / 3) self.SetPosition(camX, camY, camZ, billboardX, billboardY, billboardZ) #self.OnDraw() #self.SwapBuffers() def DrawBillboard(self, x, y, z, filename, textureCount): self.textureId = self.LoadImage(filename, textureCount) self.SetupTexture(textureCount) glBindTexture(GL_TEXTURE_2D, self.vizImageIds[textureCount]) # Added 20061003 glBegin(GL_QUADS) leftX = x * (self.distX + self.width) rightX = leftX + self.width bottomY = y topY = y + self.height z = z * self.distZ glNormal3f(0.0, 0.0, -1.0) glTexCoord2f(0.0, 0.0); glVertex3f(leftX, bottomY, z) glTexCoord2f(1.0, 0.0); glVertex3f(rightX, bottomY, z) glTexCoord2f(1.0, 1.0); glVertex3f(rightX, topY, z) glTexCoord2f(0.0, 1.0); glVertex3f(leftX, topY, z) #glTexCoord2f(0.0, 0.0); glVertex3f(leftX, bottomY, z) #glTexCoord2f(0.0, 1.0); glVertex3f(leftX, topY, z) #glTexCoord2f(1.0, 1.0); glVertex3f(rightX, topY, z) #glTexCoord2f(1.0, 0.0); glVertex3f(rightX, bottomY, z) glEnd() def SetupTexture(self, textureId): glEnable(GL_TEXTURE_2D) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST) glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL) #glBindTexture(GL_TEXTURE_2D, self.vizImageIds[textureId]) # Added 20061003 def LoadImage(self, filename, id): # First, load bitmap if filename == None: return None textureImageFile = None textureImageFile = open(filename, 'r') if textureImageFile: textureImageFile.close() im = Image.open(filename) try: ix, iy, image = im.size[0], im.size[1], im.tostring("raw", "RGBA", 0, -1) except SystemError: ix, iy, image = im.size[0], im.size[1], im.tostring("raw", "RGBX", 0, -1) glPixelStorei(GL_UNPACK_ALIGNMENT, 1) glTexImage2D(GL_TEXTURE_2D, 0, 3, ix, iy, 0, GL_RGBA, GL_UNSIGNED_BYTE, image) return self.vizImageIds[id] def CreateDisplayList(self): print "In Gallery.CreateDisplayList" self.billboardList = glGenLists(1) glNewList(self.billboardList, GL_COMPILE) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); # Draw a matrix of billboards #glBegin(GL_QUADS) textureCount = 0 for x in range(0, self.xMapSize): for z in range(0, self.yMapSize): textureFilename = self.myVizEngine.getViz([x, z]) y = 0 self.DrawBillboard(x, y, z, textureFilename, textureCount) textureCount += 1 #glEnd() self.LookAt(0, 0) #self.LookAt(0, 0) glEndList() def InitGL(self): print "In Gallery.InitGL" self.SetCurrent() glClearColor(0.7, 0.7, 0.7, 0.0) glShadeModel(GL_FLAT) glEnable(GL_DEPTH_TEST) glMatrixMode(GL_MODELVIEW) # Following commands affect model glLoadIdentity() self.vizImageIds = glGenTextures(self.xMapSize * self.yMapSize + 1) self.CreateDisplayList() #self.LookAt(0, 0) #self.OnDraw() #self.SwapBuffers() def FinishGL(self): pass class HistoryView(scrolled.ScrolledPanel): SPACING = 1 def __init__(self, parent, navigationWin): #wx.ScrolledWindow.__init__(self, parent, id=-1, pos=wx.DefaultPosition, # size=(700, 100), style=wx.HSCROLL, # name="History View") scrolled.ScrolledPanel.__init__(self, parent, -1, size=(840, 200)) #self.SetSize((700, 100)) #self.panel = wx.Panel(self, style=wx.BORDER_SUNKEN, size=(700, 100)) self.navigationWin = navigationWin self.history = navigationWin.history self.boxSizer = wx.BoxSizer(wx.HORIZONTAL) self.myVizEngine = vizGenerator.vizEngine.vizEngine(MAP_FILE_NAME, DATA_FILE_NAME) #self.OnDraw() #self.SetSizerAndFit(self.boxSizer) self.SetSizer(self.boxSizer) self.SetupScrolling(scroll_x=True) self.FitInside() # def OnDraw(self): # for x in range(0, self.history.getLength()): # currPos = self.history.getPosition(x) # textureFilename = myVizEngine.getViz([currPos.x, currPos.z]) # image = wx.Image(textureFilename, wx.BITMAP_TYPE_BMP) # width = image.GetWidth() # height = image.GetHeight() # print "Image Size: ", width, height # scaledImage = image.Scale(width * self.SCALE_FACTOR, height * self.SCALE_FACTOR) # #staticBitmap = wx.StaticBitmap(self.panel, -1, wx.BitmapFromImage(scaledImage)) # staticBitmap = wx.StaticBitmap(self, -1, wx.BitmapFromImage(scaledImage)) # self.boxSizer.Add(staticBitmap, 0, wx.ALL, self.SPACING) # # #self.Fit() # self.FitInside() def AddPosition(self, position): #currPos = self.history.getPosition(self.history.length - 1) #staticBitmap = wx.StaticBitmap(self, -1, wx.BitmapFromImage(scaledImage)) #staticBitmap = statbmp.GenStaticBitmap(self, wx.ID_ANY, scaledImage) historyButton = HistoryButton(self, position, self.myVizEngine) self.boxSizer.Add(historyButton, 0, wx.ALL, self.SPACING) self.FitInside() #size = self.GetVirtualSize() #self.Scroll(size[0], self.yPos) # def OnClick(self, event): #print "Image: was clicked at %i, %i " % (event.GetX(), event.GetY()) class HistoryButton(buttons.GenBitmapButton): SCALE_FACTOR = 0.5 def __init__(self, parent, position, vizEngine): self.position = position self.parent = parent textureFilename = vizEngine.getViz([position.x, position.z]) image = wx.Image(textureFilename, wx.BITMAP_TYPE_BMP) #image = wx.Bitmap(textureFilename) width = image.GetWidth() height = image.GetHeight() #print "Image Size: ", width, height scaledImage = image.Scale(width * self.SCALE_FACTOR, height * self.SCALE_FACTOR) bitmapImage = scaledImage.ConvertToBitmap() buttons.GenBitmapButton.__init__(self, parent, -1, bitmapImage, pos=(0, 0), style=0) self.Bind(wx.EVT_BUTTON, self.OnClick, self) def OnClick(self, event): self.parent.navigationWin.setPosition(self.position) #class HistoryView(myGLWindow): # textureImageIds = [] # # def __init__(self, parent, history): # self.history = history # myGLWindow.__init__(self, parent) # self.OnDraw() # # def OnDraw(self): # print "Drawing history view" # self.SetCurrent() # # clear color and depth buffers # glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); # # for x in range(0, self.history.getLength()): # currPos = self.history.getPosition(x) # textureFilename = myVizEngine.getViz([currPos.x, currPos.z]) # # self.textureId = self.LoadImage(textureFilename, x) # self.SetupTexture(x) # # leftX = 1.5 * x # rightX = 1.5 * x + 1 # bottomY = 0 # topY = 1 # z = 0 # # glBegin(GL_QUADS) # glTexCoord2f(0.0, 0.0); glVertex3f(leftX, bottomY, z) # glTexCoord2f(1.0, 0.0); glVertex3f(rightX, bottomY, z) # glTexCoord2f(1.0, 1.0); glVertex3f(rightX, topY, z) # glTexCoord2f(0.0, 1.0); glVertex3f(leftX, topY, z) # glEnd() # # glLoadIdentity() # gluLookAt(2.5, 0.5, 1.0, # camera position # 2.5, 0.5, 0.0, # camera aimed at # 0.0, 1.0, 0.0) # view-up matrix # # self.SwapBuffers() # # def InitGL(self): # #print "In InitGL for History View" # self.SetCurrent() # glClearColor(0.7, 0.7, 0.7, 0.0) # glShadeModel(GL_FLAT) # glEnable(GL_DEPTH_TEST) # # glMatrixMode(GL_MODELVIEW) # Following commands affect model # glLoadIdentity() # # self.textureImageIds = glGenTextures(MAX_HISTORY_SIZE) # self.SwapBuffers() # # def LoadImage(self, filename, id): # self.SetCurrent() # # First, load bitmap # if filename == None: # return None # textureImageFile = None # textureImageFile = open(filename, 'r') # if textureImageFile: # textureImageFile.close() # im = Image.open(filename) # try: # ix, iy, image = im.size[0], im.size[1], im.tostring("raw", "RGBA", 0, -1) # except SystemError: # ix, iy, image = im.size[0], im.size[1], im.tostring("raw", "RGBX", 0, -1) # # glPixelStorei(GL_UNPACK_ALIGNMENT, 1) # glTexImage2D(GL_TEXTURE_2D, 0, 3, ix, iy, 0, GL_RGBA, GL_UNSIGNED_BYTE, image) # self.SwapBuffers() # return self.textureImageIds[id] # # def SetupTexture(self, textureId): # self.SetCurrent() # glEnable(GL_TEXTURE_2D) # glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT) # glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT) # glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) # glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST) # # glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL) # # glBindTexture(GL_TEXTURE_2D, self.textureImageIds[textureId]) # Added 20061003 # self.SwapBuffers() # class CurrentView(wx.Panel): def __init__(self, parent): self.position = [0, 0] wx.Panel.__init__(self, parent, style=wx.BORDER_SUNKEN, size=(60, 200)) box = wx.BoxSizer(wx.VERTICAL) self.widget = wxVTKRenderWindow(self, -1, pos=(100, 100), size=(170, 170)) myVizEngine = vizGenerator.vizEngine.vizEngine(MAP_FILE_NAME, DATA_FILE_NAME) ren = myVizEngine.getVtkViz(self.position) self.widget.GetRenderWindow().AddRenderer(ren) box.Add(self.widget, 0, wx.ALIGN_RIGHT) self.SetSizer(box) def SetPosition(self, position): self.position = position def OnDraw(self): self.widget = wxVTKRenderWindow(self, -1, pos=(100, 100), size=(170, 170)) myVizEngine = vizGenerator.vizEngine.vizEngine(MAP_FILE_NAME, DATA_FILE_NAME) ren = myVizEngine.getVtkViz(self.position) self.widget.GetRenderWindow().AddRenderer(ren) ============================================ |
From: <sh...@lo...> - 2007-10-22 23:26:33
|
Hello, I'm having trouble with a PyOpenGL application that I'm trying to run. I'm hoping it's a configuration error. Here is the error I get: ============================================ (python:3903): Gdk-WARNING **: gdkdrawable-x11.c:878 drawable is not a pixmap or window (python:3903): Gdk-WARNING **: gdkdrawable-x11.c:878 drawable is not a pixmap or window The program 'python' received an X Window System error. This probably reflects a bug in the program. The error was 'GLXBadDrawable'. (Details: serial 286 error_code 156 request_code 143 minor_code 11) (Note to programmers: normally, X errors are reported asynchronously; that is, you will receive the error a while after causing it. To debug your program, run it with the --sync command line option to change this behavior. You can then get a meaningful backtrace from your debugger if you break on the gdk_x_error() function.) ============================================== When I instantiate the an object of type Gallery (the class definition is shown below), I get this error. The same code runs fine on another Linux computer, and I have another program on this system that creates a similar class (a child of glcanvas.GLCanvas) and works fine, and I absolutely cannot figure out the difference between the two. Does anyone have any ideas for me? Thank you very much in advance - I have been tearing out my hair trying to solve this problem. Shari Here is the class that seems to cause the problem: =============================================== import wx from wx import glcanvas import Image from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * class myGLCanvas(glcanvas.GLCanvas): def __init__(self, parent): glcanvas.GLCanvas.__init__(self, parent, -1) self.init = False # initial mouse position self.lastx = self.x = 30 self.lasty = self.y = 30 self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) self.Bind(wx.EVT_SIZE, self.OnSize) self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_LEFT_DOWN, self.OnMouseDown) self.Bind(wx.EVT_LEFT_UP, self.OnMouseUp) self.Bind(wx.EVT_MOTION, self.OnMouseMotion) self.InitGL() def OnEraseBackground(self, event): pass # Do nothing, to avoid flashing on MSW. def OnSize(self, event): self.SetCurrent() size = self.GetClientSize() if self.GetContext(): self.SetCurrent() if (True): if (size.height == 0): size.height = 1 # prevent divide by 0 glViewport(0, 0, size.width, size.height) glMatrixMode(GL_PROJECTION) glLoadIdentity() # Calculate the aspect ratio of the window gluPerspective(80.0, float(size.width) / float(size.height), 1.0, 50.0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() self.OnDraw() event.Skip() def OnPaint(self, event): dc = wx.PaintDC(self) self.SetCurrent() if not self.init: self.InitGL() self.init = True self.OnDraw() def OnMouseDown(self, evt): self.CaptureMouse() def OnMouseUp(self, evt): self.ReleaseMouse() def OnMouseMotion(self, evt): if evt.Dragging() and evt.LeftIsDown(): self.x, self.y = self.lastx, self.lasty self.x, self.y = evt.GetPosition() self.Refresh(False) class Gallery(myGLCanvas): SIZE_X = 1.0 SIZE_Y = 1.0 DIST_X = 0.5 DIST_Z = 1.0 BOTTOM_Y = -0.5 # TODO: Change this after I get it working xMapSize = 1 yMapSize = 2 def InitGL(self): print "In InitGL" self.SetCurrent() glClearColor(0.7, 0.7, 0.7, 0.0) glShadeModel(GL_FLAT) glutInitDisplayMode(GLUT_DEPTH) glEnable(GL_ALPHA_TEST) glEnable(GL_DEPTH_TEST) glEnable(GL_LIGHTING) glEnable(GL_LIGHT0) glMatrixMode(GL_MODELVIEW) # Following commands affect model glLoadIdentity() # Generate a set of textures to use self.vizImageIds = glGenTextures(self.xMapSize * self.yMapSize + 1) self.billboardList = 0 self.CreateDisplayList() self.OnDraw() def OnDraw(self): self.SetCurrent() glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glCallList(self.billboardList) glFlush() glLoadIdentity() # gluLookAt( 1.0, 0.0, -0.5, # camera position # 1.0, 0.0, 1.0, # camera aimed at # 0.0, 1.0, 0.0) # view-up matrix self.SwapBuffers() def DrawBillboard(self, x, z, filename, textureCount): self.textureId = self.LoadImage(filename, textureCount) self.SetupTexture(textureCount) glBindTexture(GL_TEXTURE_2D, self.vizImageIds[textureCount]) # Added 20061003 glBegin(GL_QUADS) leftX = x * (self.SIZE_X + self.DIST_X) rightX = leftX + self.SIZE_X bottomY = self.BOTTOM_Y topY = bottomY + self.SIZE_Y zVal = z * self.DIST_Z + 1.0 print "zVal = ", zVal glNormal3f(0.0, 0.0, 1.0) glTexCoord2f(1.0, 1.0); glVertex3f(rightX, topY, zVal) glTexCoord2f(0.0, 1.0); glVertex3f(leftX, topY, zVal) glTexCoord2f(0.0, 0.0); glVertex3f(leftX, bottomY, zVal) glTexCoord2f(1.0, 0.0); glVertex3f(rightX, bottomY, zVal) glEnd() def LoadImage(self, filename, id): # First, load bitmap if filename == None: return None textureImageFile = None textureImageFile = open(filename, 'r') if textureImageFile: textureImageFile.close() im = Image.open(filename) try: ix, iy, image = im.size[0], im.size[1], im.tostring("raw", "RGBA", 0, -1) except SystemError: ix, iy, image = im.size[0], im.size[1], im.tostring("raw", "RGBX", 0, -1) glPixelStorei(GL_UNPACK_ALIGNMENT, 1) glTexImage2D(GL_TEXTURE_2D, 0, 3, ix, iy, 0, GL_RGBA, GL_UNSIGNED_BYTE, image) return self.vizImageIds[id] def SetupTexture(self, textureId): glEnable(GL_TEXTURE_2D) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST) glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL) def CreateDisplayList(self): self.billboardList = glGenLists(1) glNewList(self.billboardList, GL_COMPILE) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); # Draw a matrix of billboards textureCount = 0 for x in range(0, self.xMapSize): for z in range(0, self.yMapSize): #textureFilename = self.myVizEngine.getViz([x, z]) textureFilename = "/home/shari/thesisFiles/TestFileName.bmp" textureCount = 0 self.DrawBillboard(x, z, textureFilename, textureCount) textureCount += 1 glEndList() |
From: Mike C. F. <mcf...@vr...> - 2007-10-16 12:52:10
|
vwf wrote: > Hello, > > I have a rather old problem that fails to work after upgrading. The > problem is that font-rendering does not work correctly. The result looks > like the a television that lost horizontal sync. > > I think I use old code, but I don't know what is wrong. I include a > small programme that works, but displays incorrectly (it is a Q&D cut > from my real programme). Any suggestions, or a pointer to an example I > can use? > PyGame fonts require an axis swap sometimes. Honestly I normally just try both flipped and un-flipped, exchanging x and y and not, and the combination that looks right is the one I use. You seem to be using a package I'm not familiar with: > from pygamefont import * > so I'm afraid I don't have any particular help to offer, though I'd suggest trying a flip and/or an x/y coordinate swap of the images. HTH, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |