On 3/9/08, Patrick Devine <[EMAIL PROTECTED]> wrote: > > Hey guys, > > I've been struggling with a few things with Pyglet and figured I'd > fire off an email to the list. > > 1. Is TGA file support broken? I tried loading a TGA file with > image.load on OSX 10.4 and ended up with the error: > > Traceback (most recent call last): > File "LoadTGA.py", line 84, in <module> > main() > File "LoadTGA.py", line 77, in main > Render() > File "LoadTGA.py", line 51, in Render > m_tga.blit(250, 400, 0) > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/pyglet/image/__init__.py", > line 708, in blit > self.texture.blit(x, y, z, width, height) > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/pyglet/image/__init__.py", > line 1316, in blit > x + w, y, z, 1., > TypeError: unsupported operand type(s) for +: 'int' and 'NoneType' > > This is with pyglet 1.0. I haven't tried it with 1.1 as of yet. If I > convert the file to a png it works fine.
There was a bug in pyglet 1.0 in which some QuickTime files that failed to load wouldn't give an error until much later (fixed in 1.1). This is probably what you're running into. Although TGA appears in the supported image formats list in the programming guide for OS X, this is a guide only... it's possible that not all TGA files are supported. If you've got a file that loads in, say, Preview, but causes an error in pyglet, let me know. > > 2. If I access the pixel data should I be able to pass it to a call > to glDrawPixels() instead of using the blit method? I realize this > doesn't make a ton of sense, but I'm trying to see what is and is not > possible w/ pyglet and OpenGL. I've been playing around with > glBitmap() which seems to work fine as long as you use ctypes to > construct a GLubyte array. There shouldn't be any problem. > > 3. Is it possible to make calls to glGetIntegerv()? I ran into this > last night: > > >>> x = GLint > >>> glGetIntegerv(GL_MAX_LIGHTS, x) > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: > expected LP_c_long instance instead of _ctypes.SimpleType Just need to get the ctypes right: >>> x = GLint() >>> glGetIntegerv(GL_MAX_LIGHTS, x) >>> x.value 8 > 4. Is there a canonical way to parse the return value of > glGetString()? The ctypes manual mentions using libc strchr(), but > this isn't very cross platform. I cooked up something quickly using > chr() and exiting a while loop when I find a null character, but it > seems like there has to be a better (ie. more pythonic) way of doing > this. If I try to do this in a list comprehension it just segfaults > since it doesn't know when to stop on the null value. The pyglet.gl.gl_info module provides Python strings of all the documented OpenGL strings. If the one you're after isn't there, you can at least grab the code and adapt. Alex. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en -~----------~----~----~----~------~----~------~--~---
