Thanks, Alex! Correct that our test-beds have been two MacBook Pros under Leopard. Will try other setups and report back. What did you test under?
jason & mark On Aug 27, 6:35 pm, "Alex Holkner" <[EMAIL PROTECTED]> wrote: > On 8/27/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > > I'm trying to animate a loop through a set of images at an average of > > 1 fps, convert them to textures and then map them to a quad. > > I'm not loading them into memory at the start, but on the fly. > > Running with only three images at 1600x900 the script dies within a > > minute or so with a memory error. > > > I'm reassigning the texture variable (self.img) with each loop, and > > have tried several ways to garbage collect it but > > it appears the texture data persists until it overflows. Am I going > > about this wrong, has anyone else encountered this? > > > i've tried: > > self.img = None > > del self.img > > ...etc... > > > It's important for this to be scalable, so loading them all into > > memory at the start is not an option. > > > from __future__ import division > > from math import pi, sin, cos > > from numpy import * > > from pyglet import image > > from pyglet.gl import * > > from pyglet import clock > > from pyglet import window > > from pyglet.window import key > > import pyglet > > import random > > import glob, os, sys > > import gc > > > try: > > config = Config(sample_buffers=1, samples=4, double_buffer=True,) > > w = window.Window(resizable=True, config=config) > > > except window.NoSuchConfigException: > > w = window.Window(resizable=True) > > > def setup(): > > glClearColor(0, 0, 0, 1) > > glDisable(GL_DEPTH_TEST) > > glEnable(GL_LIGHT0) > > glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR) > > glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR) > > glEnable(player.img.target) > > glBindTexture(player.img.target, player.img.id) > > > @w.event > > def on_resize(width, height): > > glViewport(0, 0, width, height) > > glMatrixMode(GL_PROJECTION) > > glLoadIdentity() > > gluPerspective(60., float(width) / float(height), .1, 1000.) > > glMatrixMode(GL_MODELVIEW) > > glClearColor(0, 0, 0, 1) > > glDisable(GL_DEPTH_TEST) > > glEnable(GL_LIGHT0) > > glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR) > > glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR) > > glPolygonMode(GL_FRONT_AND_BACK, GL_FILL) > > return pyglet.event.EVENT_HANDLED > > > class Player(): > > def __init__(self): > > self.images = ['image.png','image2.png','iamge3.png'] > > self.x = 0 > > self.img = image.load(self.images[0]).texture > > def new_img(self,dt): > > self.x += 1 > > self.img = image.load(self.images[self.x%3]).texture > > > def draw(self): > > glPolygonMode(GL_FRONT_AND_BACK, GL_FILL) > > glBegin(GL_QUADS) > > glTexCoord2f(0,0) > > glVertex2f(-1,-1) > > glTexCoord2f(0,1) > > glVertex2f(-1,1) > > glTexCoord2f(1,1) > > glVertex2f(1,1) > > glTexCoord2f(1,0) > > glVertex2f(1,-1) > > glEnd() > > > player = Player() > > setup() > > > pyglet.clock.schedule_interval(player.new_img, 0.001) > > > @w.event > > def on_draw(): > > glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) > > glLoadIdentity() > > glTranslatef(0,0,-3) > > player.draw() > > > pyglet.app.run() > > Hello, > > I tried your program with some reasonably-sized images but didn't see > any memory leak, nor did the program crash. This probably means the > problem is specific to your video driver or operating system (which > you didn't specify). > > If you set the environment variable PYGLET_DEBUG_TEXTURE to 1, pyglet > will print out its estimate of the current texture memory usage after > any texture allocation or deallocation. For example, I get: > > 4194304 (+4194304) > 8388608 (+4194304) > 4194304 (-4194304) > 8388608 (+4194304) > 4194304 (-4194304) > 8388608 (+4194304) > 4194304 (-4194304) > 8388608 (+4194304) > 4194304 (-4194304) > 8388608 (+4194304) > 4194304 (-4194304) > etc > > The number in brackets shows the change in memory since the last reading. > > 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 -~----------~----~----~----~------~----~------~--~---
