pyopengl-users Mailing List for PyOpenGL (Page 72)
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: Andrew W. <and...@al...> - 2007-02-08 12:37:28
|
Hello, I'm trying to use gluBuild3DMipmaps, but I come upon the following error message, OpenGL.error.NullFunctinoError: Attempt to call an undefined function gluBuild3DMipmaps, check for bool(gluBuild3DMipmaps) before calling. So I print out bool(gluBuild3DMipmaps) and of course get False. how do I get gluBuild3DMipmaps working? I'm running pyopengl-3.0.0a5-py2.4.egg Thanks Andrew |
From: Martin F. <fe...@in...> - 2007-02-07 15:15:43
|
Hi, in trying to get my python OpenGL application to run under cygwin, I installed the PyOpenGL package, version 3.0.0a5 for python 2.4, and ctypes 1.0.1. For one thing, could it be the .egg is broken? I keep getting 225> easy_install PyOpenGL-3.0.0a5-py2.4.egg Processing PyOpenGL-3.0.0a5-py2.4.egg Traceback (most recent call last): File "/usr/bin/easy_install", line 7, in ? sys.exit( File "/usr/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/setuptools/command/easy_install.py", line 1670, in m ain with_ei_usage(lambda: File "/usr/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/setuptools/command/easy_install.py", line 1659, in w ith_ei_usage return f() File "/usr/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/setuptools/command/easy_install.py", line 1674, in < lambda> distclass=DistributionWithoutHelpCommands, **kw File "/tmp/python.340/usr/lib/python2.4/distutils/core.py", line 149, in setup File "/tmp/python.340/usr/lib/python2.4/distutils/dist.py", line 946, in run_commands File "/tmp/python.340/usr/lib/python2.4/distutils/dist.py", line 966, in run_command File "/usr/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/setuptools/command/easy_install.py", line 211, in ru n self.easy_install(spec, not self.no_deps) File "/usr/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/setuptools/command/easy_install.py", line 427, in ea sy_install return self.install_item(None, spec, tmpdir, deps, True) File "/usr/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/setuptools/command/easy_install.py", line 471, in in stall_item dists = self.install_eggs(spec, download, tmpdir) File "/usr/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/setuptools/command/easy_install.py", line 619, in in stall_eggs return [self.install_egg(dist_filename, tmpdir)] File "/usr/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/setuptools/command/easy_install.py", line 670, in in stall_egg dist = self.egg_distribution(egg_path) File "/usr/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/setuptools/command/easy_install.py", line 661, in eg g_distribution metadata = EggMetadata(zipimport.zipimporter(egg_path)) zipimport.ZipImportError: not a Zip file: 'PyOpenGL-3.0.0a5-py2.4.egg' Well, anyway, the .zip file worked. Now whenever I try to run an OpenGL application, the following happens: Traceback (most recent call last): File "GLvis.py", line 8, in ? from OpenGL.GL import * File "/usr/lib/python2.4/site-packages/PyOpenGL-3.0.0a5-py2.4.egg/OpenGL/GL/__init__.py", line 2, in ? from OpenGL.raw.GL import * File "/usr/lib/python2.4/site-packages/PyOpenGL-3.0.0a5-py2.4.egg/OpenGL/raw/GL/__init__.py", line 6, in ? from OpenGL.raw.GL.constants import * File "/usr/lib/python2.4/site-packages/PyOpenGL-3.0.0a5-py2.4.egg/OpenGL/raw/GL/constants.py", line 7, in ? from OpenGL import platform, arrays File "/usr/lib/python2.4/site-packages/PyOpenGL-3.0.0a5-py2.4.egg/OpenGL/platform/__init__.py", line 24, in ? from OpenGL.platform.glx import * File "/usr/lib/python2.4/site-packages/PyOpenGL-3.0.0a5-py2.4.egg/OpenGL/platform/glx.py", line 29, in ? mode=ctypes.RTLD_GLOBAL File "/usr/lib/python2.4/site-packages/PyOpenGL-3.0.0a5-py2.4.egg/OpenGL/platform/ctypesloader.py", line 37, in loadLibrary return dllType( name, mode ) File "/usr/lib/python2.4/site-packages/ctypes/__init__.py", line 312, in __init__ self._handle = _dlopen(self._name, mode) OSError: No such file or directory When this happens, self._name is "GL" and mode is 4. It would seem as though somehow the GL library is not registered(?) with python? I'm at a loss here - can anybody give me a hint? Has there been any successful attempt at running PyOpenGL under cygwin? I append a cygwin configuration dump. Thanks, Martin |
From: Mike C. F. <mcf...@vr...> - 2007-02-06 22:52:47
|
Greg Ewing wrote: > k0wax wrote: > >> How can I import all constants from OpenGL.GL without importing all >> functions? (from OpenGL.GL import *) >> > > Maybe something like > > g = globals() > for name, value in OpenGL.GL.__dict__.items(): > if name == name.upper(): > g[name] = value > If the goal is just to get the constants (and you don't care about loading the functions as you do so): from OpenGL.raw.GL.constants import * will work with PyOpenGL 3.x. You will, however, miss the "alias" entries from the header file. You're also going to have all the initialisation overhead of creating the functions, as they are created when OpenGL.raw.GL is imported in importing the final module. HTH, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: Greg E. <gre...@ca...> - 2007-02-06 22:26:08
|
k0wax wrote: > How can I import all constants from OpenGL.GL without importing all > functions? (from OpenGL.GL import *) Maybe something like g = globals() for name, value in OpenGL.GL.__dict__.items(): if name == name.upper(): g[name] = value -- Greg |
From: Vasilis P. <aza...@gm...> - 2007-02-06 14:30:52
|
On 2/6/07, Mike C. Fletcher <mcf...@vr...> wrote: > Key thing is that we (somehow) have to register the PyOpenGL .egg > directory (copied into the distribution directly) on the Python path. > Once it's registered the setuptools mechanisms seem to correctly handle > the entry point registrations. Py2exe doesn't, by default, process .pth > or similar mechanisms for adding a directory, so we need to manually do > it (i.e. in code). Possibly the py2exe people will know how to handle > the registration more elegantly. Basically, I create a silly little > "site.py" file with these contents in the dist directory: > > import sys, os > sys.path.insert( > 0, > os.path.join( > os.path.dirname( sys.executable ), > 'PyOpenGL-3.0.0a5-py2.5.egg' > ) > ) > > exclude OpenGL from the py2exe project, include ctypes.* and weakref and > then build. If my script does an "import site" before importing > PyOpenGL I get a working PyOpenGL-bearing exe. More general solution > would be to allow for a scan of the directory looking for the .egg > files/directories and adding them to the path, but that seems like > something that should be part of py2exe/py2app, rather than something > PyOpenGL adds in. That should IIUC be pretty much the exact code in the > regular site.py. > > Anyway, hopefully that will be enough to get you started. I'd love to > see this problem fixed properly some day, > Mike > > -- > ________________________________________________ > Mike C. Fletcher > Designer, VR Plumber, Coder > http://www.vrplumber.com > http://blog.vrplumber.com > > Thank you! Importing that script works fine! I suppose I could remove the Demos dir and other not actually needed dirs to make it a bit smaller, but that's not really important.. I really appreciate your help =D |
From: Mike C. F. <mcf...@vr...> - 2007-02-06 08:41:00
|
Blake Winton wrote: > Vasilis Platanias wrote: >> I'm getting this strange problem when I try to bundle an opengl app : ... >> and I get the same error. >> I've also tried the --excludes=OpenGL option, and then adding the >> entire OpenGL dir in the archive libraries, but with the exact same >> results. >> I suspect this is not a ctypes problem, but some kind of >> initialization problem, because I've managed to recreate it with >> c_uint and int in the place of c_ulong. There definitely should be a >> type handler for c_uint or plain int.. > > I got the same thing with py2app, and never did manage to get it > figured out. If you come up with a solution I'ld love to hear about it! > > (I've also Cc:ed Mike Fletcher, the maintainer of PyOpenGL, on this > email, since it seems like the sort of thing he'ld be interested in.) I've just got a somewhat working version of an OpenGL project (just dots.py from the Demos). Key thing is that we (somehow) have to register the PyOpenGL .egg directory (copied into the distribution directly) on the Python path. Once it's registered the setuptools mechanisms seem to correctly handle the entry point registrations. Py2exe doesn't, by default, process .pth or similar mechanisms for adding a directory, so we need to manually do it (i.e. in code). Possibly the py2exe people will know how to handle the registration more elegantly. Basically, I create a silly little "site.py" file with these contents in the dist directory: import sys, os sys.path.insert( 0, os.path.join( os.path.dirname( sys.executable ), 'PyOpenGL-3.0.0a5-py2.5.egg' ) ) exclude OpenGL from the py2exe project, include ctypes.* and weakref and then build. If my script does an "import site" before importing PyOpenGL I get a working PyOpenGL-bearing exe. More general solution would be to allow for a scan of the directory looking for the .egg files/directories and adding them to the path, but that seems like something that should be part of py2exe/py2app, rather than something PyOpenGL adds in. That should IIUC be pretty much the exact code in the regular site.py. Anyway, hopefully that will be enough to get you started. I'd love to see this problem fixed properly some day, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: k0wax <k0w...@gm...> - 2007-02-05 21:54:29
|
pyOpenGL 3.0.0a5. "OpenGL.GL.constants" contains basic conts like GL_BYTE All other constants can be imported this way: "from OpenGL.GL import GL_LINEAR" How can I import all constants from OpenGL.GL without importing all functions? (from OpenGL.GL import *) |
From: Mike C. F. <mcf...@vr...> - 2007-01-26 19:45:18
|
J. Appleyard wrote: > Python 2.4.4, PyOpenGL-3.0.0a5 and a4. > > glGetString(GL_EXTENSIONS) seems to be returning none. I have no idea why. > Has anybody any idea what could be causing this? I tried running an > extension viewer, and it can find them find, however PyOpenGL doesn't seem > to be able to find any. > You are most likely calling the function before you have a valid rendering context. At least on my machine that returns None. Calling with an active context should return the set of extensions. HTH, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: J. A. <ja...@ca...> - 2007-01-26 17:38:15
|
Python 2.4.4, PyOpenGL-3.0.0a5 and a4. glGetString(GL_EXTENSIONS) seems to be returning none. I have no idea why. Has anybody any idea what could be causing this? I tried running an extension viewer, and it can find them find, however PyOpenGL doesn't seem to be able to find any. I've not used extensions before so there is a chance I could be doing something moronic, however I'm not sure. I used the python code fot the NeHe lesson 41 (http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=41) which I would imagine is meant to work, and after a bit of backtracking found that PyOpenGL was trying to split the NoneType object returned from glGetString(GL_EXTENSIONS). Any ideas? Jeremy Appleyard |
From: Jozef V. <ve...@gj...> - 2007-01-25 23:58:22
|
Good day, I started playing with OpenGL in python and just can't figure out - why this works: from Tkinter import Frame f = Frame(width = 200, height = 200) f.pack() f.mainloop() f = Frame(width = 200, height = 200) f.pack() f.mainloop() shows second window after closing first one - this does not: from OpenGL.Tk import Opengl o = Opengl(width = 200, height = 200) o.redraw = lambda x: None o.pack() o.mainloop() o = Opengl(width = 200, height = 200) o.redraw = lambda x: None o.pack() o.mainloop() shows first window, and crashes after it is closed Traceback (most recent call last): File "./test.py", line 11, in ? o = Opengl(width = 200, height = 200) File "/usr/lib/python2.4/site-packages/OpenGL/Tk/__init__.py", line 233, in __init__ apply(RawOpengl.__init__, (self, master, cnf), kw) File "/usr/lib/python2.4/site-packages/OpenGL/Tk/__init__.py", line 188, in __init__ Widget.__init__(self, master, 'togl', cnf, kw) File "/usr/lib/python2.4/lib-tk/Tkinter.py", line 1862, in __init__ self.tk.call( _tkinter.TclError: invalid command name "togl" Those are results form TOgl-1.5, 1.6 crashed after import, 1.7 did not work either (I tried, but I don't remeber symptoms) Thanks for any hints Good bye Jozef Vesely ve...@gj... |
From: Amy L. <al...@ms...> - 2007-01-16 16:41:00
|
Hi, I'm a newbie to both python and graphics programming. I recently took a course in both, and thought that I was ready to work on a major program. Boy, was I wrong. I currently have an ongoing project that renders multiple objects to the screen (i.e. a line with two endpoints -- all are separate entites rendered to the screen such that it appears to be one object). I'm currently trying to move one single endpoint and then update the line accordingly. Currently, my "move" function translates the entire scene as one entity. Can anyone help me move a single endpoint of the line and then update the drawing? BTW, to determine what entity that I have picked, I am implementing the selection buffer. That part seems to be working fine for selection and de-selection. Thanks, Amy ------------------------------ Amy Ladner Research Assistant, HPCC M.S. Computational Engineering Mississipp State University |
From: Mike C. F. <mcf...@vr...> - 2007-01-11 06:56:35
|
red puck wrote: > Hello, Everyone, > > I found a interesting question here. > > I use the first sample program from chapter 24 from > Python How to Program By Harvey M. Deitel, Paul J. > Deitel, Jonathan P. Liperi, BA Wiedermann; Prentice > Hall, 2002. > > This program can get correct figure. But I found a > interesting thing here. or maybe it is a bug? > > The run of the program like following > ... > The key problem is here. The source code works well, > but once I compiled it with Cx_freeze. The executable > doesn't work. > > Anybody can clear this for me? > I can clear up the "why", but don't yet have a solution. Basically, the various application-building systems, such as py2app, py2exe and cx_freeze don't yet support the setuptools/egg format properly. They neglect to properly register the bundled-up eggs, so the setuptools-based plugin code (which handles the array formats) never gets registered or invoked. At the moment I have no solution for this. I'm planning to sit down at some point and try to figure out a patch for the various tools, but my available time for OpenGL hacking is minimal these days and I'm still focused on the core functionality, more than the packaging issues. I *believe* with certain approaches with py2exe it should be possible to exclude the library entirely and then just drop the .egg into the application's distribution directory, but I haven't tried that and haven't confirmed that my understanding is correct. I'm guessing you would need to be sure that setuptools is included in the bundle as well, btw. Good luck, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: red p. <red...@ya...> - 2007-01-10 00:05:37
|
Hello, Everyone, I found a interesting question here. I use the first sample program from chapter 24 from Python How to Program By Harvey M. Deitel, Paul J. Deitel, Jonathan P. Liperi, BA Wiedermann; Prentice Hall, 2002. This program can get correct figure. But I found a interesting thing here. or maybe it is a bug? The run of the program like following "/usr/lib/python2.4/lib-tk/Tkinter.py", line 1345, in __call__ return self.func(*args) File "/usr/lib/python2.4/site-packages/OpenGL-3.0.0a4-py2.4.egg/OpenGL/Tk/__init__.py",<br /> line 548, in tkExpose self.basic_lighting() File "/usr/lib/python2.4/site-packages/OpenGL-3.0.0a4-py2.4.egg/OpenGL/Tk/__init__.py",<br /> line 323, in basic_lighting glLightfv(GL_LIGHT0, GL_POSITION, light_position) File "/usr/lib/python2.4/site-packages/OpenGL-3.0.0a4-py2.4.egg/OpenGL/wrapper.py", line 664, in wrapperCall pyArgs.append( converter(arg, self, args) ) File "/usr/lib/python2.4/site-packages/OpenGL-3.0.0a4-py2.4.egg/OpenGL/converters.py",<br /> line 113, in __call__ return self.function( incoming ) File "/usr/lib/python2.4/site-packages/OpenGL-3.0.0a4-py2.4.egg/OpenGL/arrays/arraydatatype.py",<br /> line 52, in asArray return cls.getHandler(value).asArray( value, typeCode or cls.typeConstant ) File "/usr/lib/python2.4/site-packages/OpenGL-3.0.0a4-py2.4.egg/OpenGL/arrays/arraydatatype.py Ok, The interesting thing happen here in try block in this file in line 18 Handler = cls.TYPE_REGISTRY.get(typ) In my machine, the first time, Handler equal nothing and jump out the try block and return, and then execute this function again, get correct Handler value and show right figure. The key problem is here. The source code works well, but once I compiled it with Cx_freeze. The executable doesn't work. Anybody can clear this for me? for your convenience, I attach the source code here. ######################################### # Fig 24.1: fig24_01.py # Colored, rotating box (with open top and bottom). from Tkinter import * from OpenGL.GL import * from OpenGL.Tk import * class ColorBox( Frame ): """A colorful, rotating box""" def __init__( self ): """Initialize GUI and OpenGL""" Frame.__init__( self ) self.master.title( "Color Box" ) self.master.geometry( "300x300" ) self.pack( expand = YES, fill = BOTH ) # create and pack Opengl -- use double buffering self.openGL = Opengl( self, double = 1 ) self.openGL.pack( expand = YES, fill = BOTH ) self.openGL.redraw = self.redraw # set redraw function self.openGL.set_eyepoint( 30 ) # move away from object self.amountRotated = 0 # total degrees of rotation self.increment = 2 # rotate amount in degrees self.update() # begin rotation def redraw( self, openGL ): """Draw box on black background""" # clear background and disable lighting glClearColor( 1.0, 1.0, 1.0, 0.0 ) # set clearing color glClear( GL_COLOR_BUFFER_BIT ) # clear background glDisable( GL_LIGHTING ) # constants red = ( 1.0, 0.0, 0.0 ) green = ( 0.0, 1.0, 0.0 ) blue = ( 0.0, 0.0, 1.0 ) purple = ( 1.0, 0.0, 1.0 ) vertices = \ [ ( ( -3.0, 3.0, -3.0 ), red ), ( ( -3.0, -3.0, -3.0 ), green ), ( ( 3.0, 3.0, -3.0 ), blue ), ( ( 3.0, -3.0, -3.0 ), purple ), ( ( 3.0, 3.0, 3.0 ), red ), ( ( 3.0, -3.0, 3.0 ), green ), ( ( -3.0, 3.0, 3.0 ), blue ), ( ( -3.0, -3.0, 3.0 ), purple ), ( ( -3.0, 3.0, -3.0 ), red ), ( ( -3.0, -3.0, -3.0 ), green ) ] glBegin( GL_QUAD_STRIP ) # begin drawing # change color and plot point for each vertex for vertex in vertices: location, color = vertex apply( glColor3f, color ) apply( glVertex3f, location ) glEnd() # stop drawing def update( self ): """Rotate box""" if self.amountRotated >= 500: # change rotation direction self.increment = -2 # rotate left elif self.amountRotated <= 0: # change rotation direction self.increment = 2 # rotate right # rotate box around x, y, z axis ( 1.0, 1.0, 1.0 ) glRotate( self.increment, 1.0, 1.0, 1.0 ) self.amountRotated += self.increment self.openGL.tkRedraw() # redraw geometry self.openGL.after( 10, self.update ) # call update in 10ms def main(): ColorBox().mainloop() if __name__ == "__main__": main() ################################# I add two print line in "/usr/lib/python2.4/site-packages/OpenGL-3.0.0a4-py2.4.egg/OpenGL/arrays/arraydatatype.py" and get following 0 return 0 <Opengl.arrays.numpymodule.NumpyHandler Object at 0x8ae0fcc> return ######################### handler = 0; try: print handler handler = cls.TYPE_REGISTRY.get( typ ) print handler except AttributeError, err: formathandler.FormatHandler.loadAll() cls.TYPE_REGISTRY = formathandler.FormatHandler.TYPE_REGISTRY handler = cls.TYPE_REGISTRY.get( typ ) if handler is None: if hasattr( typ, '__mro__' ): for base in typ.__mro__: if cls.TYPE_REGISTRY.has_key( base ): handler = cls.TYPE_REGISTRY[ base ] handler.registerEquivalent( typ, base ) cls.TYPE_REGISTRY[ typ ] = handler return handler raise TypeError( """No array-type handler for type %r (value: %s) registered"""%( typ, repr(value)[:50] ) ) print "return" return handler ########################## Thanks, John __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: melon <swe...@gm...> - 2006-12-25 07:26:11
|
(I'm a newbie in Python and pyOpenGL.) Environment: WinXP SP2 Python ver. 2.5 WingIDE easy_install is installed PIL, pyNum is installed Download PyOpenGL-3.0.0a5-py2.5.egg run: easy_install PyOpenGL-3.0.0a5-py2.5.egg pyOpenGL is installed in D:\Python25\Lib\site-packages\PyOpenGL-3.0.0a5-py2.5.egg\ I tried to run a example ".\OpenGL\Demo\da\dots.py", but it fails in the line: from OpenGL.GL import * with errors: AttributeError: 'WinFunctionType' object has no attribute 'returnValues' Traceback (innermost last): File "OpenGL\Demo\da\dots.py", line 1, in <module> #!/usr/bin/python File "OpenGL\Demo\da\dots.py", line 24, in <module> from OpenGL.GL import * File "OpenGL\GL\__init__.py", line 3, in <module> from OpenGL.raw.GL.annotations import * File "OpenGL\raw\GL\annotations.py", line 19, in <module> 'textures', File "OpenGL\arrays\arrayhelpers.py", line 68, in setInputArraySizeType if not hasattr( function, 'returnValues' ): File "OpenGL\wrapper.py", line 64, in __getattr__ return getattr( self.wrappedOperation, key ) It seems that pyOpenGL reimplements the module "ctypes" internally, but not finished.... I cannot find "self.wrappedOperation" with any attribute with the name of 'returnValues'. How to go through this problem? Did I make some simple mistakes at the beginning of the installation of pyOpenGL? Thank you! ShenLei |
From: Kay R. <kro...@cs...> - 2006-12-22 17:34:09
|
I was happy to see the new binaries for PyOpenGL for Python 2.5 and was hoping that you would produce a windows installer for OpenGL Context and Python 2.5 |
From: red p. <red...@ya...> - 2006-12-17 04:13:24
|
Hello, Dear All I have about 40 python seperate files and want to compile it into a executable. My source code works very well. And the exe also works, but one of function cannot work correctly, The error like following. But the Tuple is defined in /usr/lib/python2.4/site-packages/OpenGL- 3.0.0a4-py2.4.egg/OpenGL/Tk/__init__.py, in line 322. But not my input value. I use pyopengl3.00a4.py2.4. Anybody can explain it. Error: 1 TypeError Exception in Tk callback Function: <bound method NewGl.tkExpose of <gldisp.NewGl instance at 0xb6e68cec>> (type: <type 'instancemethod'>) Args: (<Tkinter.Event instance at 0xb6e7570c>,) Event type: ConfigureNotify Traceback (innermost last): File "Pmw.py", line 1383, in __call__ None File "/usr/lib/python2.4/site-packages/OpenGL- 3.0.0a4-py2.4.egg/OpenGL/Tk/__init__.py", line 548, in tkExpose self.basic_lighting() File "/usr/lib/python2.4/site-packages/OpenGL-3.0.0a4-py2.4.egg/OpenGL/Tk/__init__.py", line 323, in basic_lighting glLightfv(GL_LIGHT0, GL_POSITION, light_position) File "/usr/lib/python2.4/site-packages/OpenGL-3.0.0a4-py2.4.egg/OpenGL/wrapper.py", line 1621, in __call__ return self.finalise()( *args, **named ) File "/usr/lib/python2.4/site-packages/OpenGL-3.0.0a4-py2.4.egg/OpenGL/wrapper.py", line 664, in wrapperCall pyArgs.append( converter(arg, self, args) ) File "/usr/lib/python2.4/site-packages/OpenGL- 3.0.0a4-py2.4.egg/OpenGL/converters.py", line 113, in __call__ return self.function( incoming ) File "/usr/lib/python2.4/site-packages/OpenGL-3.0.0a4-py2.4.egg/OpenGL/arrays/arraydatatype.py", line 52, in asArray return cls.getHandler(value).asArray( value, typeCode or cls.typeConstant ) File "/usr/lib/python2.4/site-packages/OpenGL-3.0.0a4-py2.4.egg/OpenGL/arrays/arraydatatype.py", line 31, in getHandler raise TypeError( TypeError: No array-type handler for type <type 'tuple'> (value: (1, 1, 1, 0) ) registered Thanks, John __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: altern <al...@gm...> - 2006-12-15 09:33:34
|
Greg Ewing wrote: > altern wrote: > >> I tried to replace all the 0 value in all vertexes by 0.5 but it >> doesnt work either. > > You might need size[0]-0.5 and size[1]-0.5 as well. same problem as before. I tried different combinations and it doesnt seem to be one way to get it right in all machines and platforms. |
From: Greg E. <gre...@ca...> - 2006-12-14 20:56:31
|
altern wrote: > I tried to replace all the 0 value in all vertexes by 0.5 but it doesnt > work either. You might need size[0]-0.5 and size[1]-0.5 as well. -- Greg |
From: altern <al...@gm...> - 2006-12-14 09:00:55
|
hi greg Greg Ewing wrote: > altern wrote: >> The example draws a one pixel wide box in the borders of the window. >> In none of the sytems I tried so far the box was totally visible. >> There is always one or two sides missing just by one pixel. > > What coordinates are you using to draw the box, exactly? > You might need to offset them by half a pixel so that > the lines go through the centres of pixels. If you're > actually trying to draw a line between two pixels, > different systems may round it in different ways. This is the way i set the projection and draw the lines, being size=(800,600) in my example # the projection glOrtho(0, size[0], size[1], 0, 1, 0) # red marquee with diagonal lines cross glBegin(GL_LINE_LOOP) glColor3f(1,0,0) # glVertex2i(0,0) glVertex2i(size[0], size[1]) glVertex2i(0, size[1]) glVertex2i(size[0], 0) glVertex2i(0,0) # marquee glVertex2i(size[0], 0) glVertex2i(size[0], size[1]) glVertex2i(0, size[1]) glEnd() # end line loop I tried to replace all the 0 value in all vertexes by 0.5 but it doesnt work either. I also tried to change the glOrtho to glOrtho(0.5, size[0], size[1], 0.5, 1, 0) and also combining both with no luck. However if I set glOrtho like this glOrtho(-1, size[0], size[1]+1, 0, 1, 0) then it works fine on my Debian desktop and on my debian laptop but not on my laptop with XP. So I decided to do tests in all systems on my machines. This is the result: glOrtho(-1, size[0], size[1]+1, 0, 1, 0) works on Debian desktop with a matrox card works on Debian laptop with ATI glOrtho(-1, size[0], size[1]+1, -1, 1, 0) works on XP laptop with ATI glOrtho(-1, size[0]+1, size[1], 1, 0) works on XP Desktop with matrox card I also tested on and old mac ibook with ATI card running 10.4.8 and on that it works if i do glOrtho(0, size[0], size[1]+1, -1, 1, 0) Not very consistent. It seems to me that it might be more to do with the OS rather than with the cards themselves. The XP versions I am running are different but the Debian are pretty much the same. I attach my example in case anyone wants to test it out his/her machine. The glOrtho is on line 19 and i pasted different combinations of setup the glOrtho thanks! enrike |
From: Greg E. <gre...@ca...> - 2006-12-13 23:59:57
|
altern wrote: > The example draws a one pixel wide box in the borders of the > window. In none of the sytems I tried so far the box was totally > visible. There is always one or two sides missing just by one pixel. What coordinates are you using to draw the box, exactly? You might need to offset them by half a pixel so that the lines go through the centres of pixels. If you're actually trying to draw a line between two pixels, different systems may round it in different ways. -- Greg |
From: altern <al...@gm...> - 2006-12-13 18:05:07
|
hi i am using glOrtho to create a 2D projection where I map the opengl units to pixels. The problem comes when running the same example in different systems and machines I get one pixel difference between systems. The example draws a one pixel wide box in the borders of the window. In none of the sytems I tried so far the box was totally visible. There is always one or two sides missing just by one pixel. I guess this has to do with the way graphics cards decide to render the opengl units into pixels in the screen. I tested on same Debian in two different machines and i get different results. Also I guess there is no much i can do about this. But maybe I am missing something. I setup glOrtho like this glOrtho(0, 800, 600, 0, 1, 0) I am using pygame to open the window. thanks enrike |
From: Mike C. F. <mcf...@vr...> - 2006-12-02 17:34:16
|
Mike C. Fletcher wrote: ... > Urgh. Well, I guess that explains the weird code and the "init" > functions for the extensions. Going to have to fix that at the PyOpenGL > level. Grr. If it's really context-dependent we're going to have to > run an extra function for every extension function (since you can have > multiple contexts) :( . Wow, that's a sub-optimal design. Someone > should yell at the MS programmers. Oh well, Windows, what are you going > to do. > > Ah, if I'm implying correctly from the wglGetProcAddress "man page", > it's actually just that the function might not be available on *this* > context, so we just have to delay resolution until the first call (or > more realistically, do a check for NULL function pointer and if NULL do > a wglGetProcAddress to see if we can get a non-null pointer before > raising the "function is null" error). Will require that the "null > function pointer" objects be capable of replacing themselves (somehow) > with the extension function... but then the normal import mechanism > pulls them from the module directly... bah. Don't want the overhead of > an extra Python function call just to allow for late loading on windows, > we want the raw ctypes function pointers whereever possible (for > speed). This is going to be a PITA one way or another. Oh well. > > Thanks for the report, I'll try to look into it this weekend. > PyOpenGL 3.x CVS now has what appears to be a fix for this. Basically if there is a NULL pointer for an extension then every time you try to call it, before raising the error it checks to see if the function is available in the current context, if so, it loads the function and then substitutes the __call__ method for the function's call with a staticmethod wrapper (C-coded, so should be moderately fast). There is still a performance penalty, but it should make most operations fairly intuitive. The biggest problem it introduces is that any wrapper code that checks for the boolean truth of an extension function to "see if it is available" is going to think it's not available. That's pretty sub-optimal IMO. Just don't have an elegant solution to it yet. Have fun, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: Mike C. F. <mcf...@vr...> - 2006-11-28 14:31:38
|
zaltor wrote: > I'm having a bit of a problem loading extensions under Windows and I'm > wondering if I'm understanding the semantics of extension modules > correctly. > > If I run the following snippet (modeled after the sample extension > snippet in the PyOpenGL for OpenGL Programmers page) ... > on Python 2.5, I get the following result: > > <OpenGL.platform.glCreateProgramObjectARB object at 0x00F77EB0> > False > > It seems that PyOpenGL is not finding > the function pointers for the extension functions. Digging through the raw > and platform directories, it seems that function pointers are found using > wglGetProcAddress, which, according to the MSDN, returns a OpenGL > context-dependent pointer. Specifically: > > When no current rendering context exists or the function fails, > the return value is NULL. > > Hence, I modified my snippet to the following, by moving the import of > the ARB extension module to after I have a context: Urgh. Well, I guess that explains the weird code and the "init" functions for the extensions. Going to have to fix that at the PyOpenGL level. Grr. If it's really context-dependent we're going to have to run an extra function for every extension function (since you can have multiple contexts) :( . Wow, that's a sub-optimal design. Someone should yell at the MS programmers. Oh well, Windows, what are you going to do. Ah, if I'm implying correctly from the wglGetProcAddress "man page", it's actually just that the function might not be available on *this* context, so we just have to delay resolution until the first call (or more realistically, do a check for NULL function pointer and if NULL do a wglGetProcAddress to see if we can get a non-null pointer before raising the "function is null" error). Will require that the "null function pointer" objects be capable of replacing themselves (somehow) with the extension function... but then the normal import mechanism pulls them from the module directly... bah. Don't want the overhead of an extra Python function call just to allow for late loading on windows, we want the raw ctypes function pointers whereever possible (for speed). This is going to be a PITA one way or another. Oh well. Thanks for the report, I'll try to look into it this weekend. Have fun, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: zaltor <za...@gm...> - 2006-11-28 10:11:15
|
I'm having a bit of a problem loading extensions under Windows and I'm wondering if I'm understanding the semantics of extension modules correctly. If I run the following snippet (modeled after the sample extension snippet in the PyOpenGL for OpenGL Programmers page) from OpenGL.GLUT import * from OpenGL.GL.ARB.shader_objects import * import sys # initialize GLUT argv = glutInit(sys.argv) # create a window, needs to be done before glInitMultitextureARB glutCreateWindow('foo') # see if GL_ARB_multitexture is supported if not glInitShaderObjectsARB(): # it's not supported...panic! print "Help, I'm lost without GL_ARB_shader_objects!" sys.exit(1) # do something with it... print glCreateProgramObjectARB print bool(glCreateProgramObjectARB) on Python 2.5, I get the following result: <OpenGL.platform.glCreateProgramObjectARB object at 0x00F77EB0> False It seems that PyOpenGL is not finding the function pointers for the extension functions. Digging through the raw and platform directories, it seems that function pointers are found using wglGetProcAddress, which, according to the MSDN, returns a OpenGL context-dependent pointer. Specifically: When no current rendering context exists or the function fails, the return value is NULL. Hence, I modified my snippet to the following, by moving the import of the ARB extension module to after I have a context: from OpenGL.GLUT import * import sys # initialize GLUT argv = glutInit(sys.argv) # create a window, needs to be done before glInitMultitextureARB glutCreateWindow('foo') from OpenGL.GL.ARB.shader_objects import * # see if GL_ARB_multitexture is supported if not glInitShaderObjectsARB(): # it's not supported...panic! print "Help, I'm lost without GL_ARB_shader_objects!" sys.exit(1) # do something with it... print glCreateProgramObjectARB print bool(glCreateProgramObjectARB) which results in an output of: <WinFunctionType object at 0x00F7D288> True This time, it seems to have gotten the correct function. I don't think this problem is going to appear on Linux, since glXGetProcAddressARB is supposed to return context-independent function pointers and thus wouldn't have a problem finding these pointers at module import time even when there is no GL context available. So, my question is, what is the correct way to do module import of ARB extension modules? Should they be imported *after* I have gotten an OpenGL context or can they be imported at any time before I want to use the functions? If the former, that would make using QGLWidget a little bit trickier, as I would have to do a module import in the initializeGL() function and then retain the module for the other functions, like paintGL() If the latter, then I think there may be a problem in the auto-generated wrappers in the raw package, since those wrappers grab the function pointers at module-load time instead of glInitXXX time. Thanks for your time. zaltor |
From: Mike C. F. <mcf...@vr...> - 2006-11-24 17:04:36
|
red puck wrote: > I installed PyOpenGL and ctypes in my cygwin. > I've never tried to run PyOpenGL under cygwin, so I'm somewhat at a loss here. It looks as though there's a problem with the library finding function in ctypes. It's possible we could just catch the OSError and try loading the bald function. It might work, but it's just as likely to wind up doing nothing at all. See platform/ctypesloader.py for the code that does the load. The use of the GLX platform seems like it might cause problems? But then I suppose you're using an X-windows server under cygwin, not mingw32 so GLX would make sense. Good luck, Mike ... > "/usr/lib/python2.4/site-packages/OpenGL-3.0.0a4-py2.4.egg/OpenGL/platform/glx.py", > line 29, in ? > mode=ctypes.RTLD_GLOBAL > File > "/usr/lib/python2.4/site-packages/OpenGL-3.0.0a4-py2.4.egg/OpenGL/platform/ctypesloader.py", > line 30, in loadLibrary > name = util.find_library( name ) > File "ctypes/util.py", line 95, in find_library > lib = _findLib_ld(name) or _findLib_gcc(name) > File "ctypes/util.py", line 78, in _findLib_ld > res = re.search(expr, os.popen('/sbin/ldconfig -p > 2>/dev/null').read()) > OSError: [Errno 11] Resource temporarily unavailable > ... -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |