XML Feeds

.

[jitter] Frames loading & unloading

Alexandre Quessy alexandre at quessy.net
Thu Aug 2 12:23:35 MDT 2007


Hi, 
I am still looking for the most efficient way of managing multiples textures for animated sprites. I chose Lua for doing most of the work, because we can draw rectangles using only OpenGL functions, thus not resetting the transformation matrix on every loop. I need to unload and reload some textures between each scenarios, which are small 2D games. Below is the Lua function I use for loading a new texture : 

function createTexture(filename, w, h)
  texture = jit.new("jit.gl.texture", this.drawto)
  texture.dim = {w, h}
  texture:read(filename)
  texture.name = filename
  return texture 
end

(maybe setting the .dim and .name attributes is useless) I observed that using many small films read by jit.qt.movie is slower (FPS speaking) than using many textures that are already loading on the GPU. Of course ! The thing is that the VRAM is limited. I tried to  loadram the jit.qt.movie, but it is still pretty slow when playing 6 movies that are 100 X 100 px. 

I think that the best bet would be to load the textures from a list PNG files before every scenario starts. At the end of the scenario, I would delete those texture objects, or something. 

I know that is it possible to load texture by sending a message to the jit.gl.render : would this approach use less RAM or be faster than using many jit.gl.texture ? I am not much concerned about RAM, but VRAM seems to be an issue. I didn't find any VRAM monitor application for Windows (yes, it uses Windows XP). 

Otherwise, is there a way to optimize the jit.qt.movie playback ? I tried sending it the message "loadram" before, and after the "read <filename>" message, but it is still slow. 

Any input is appreciated. Thanks a lot !

a


More information about the jitter mailing list