switching between low- and high-res images in gl

    Apr 15 2011 | 8:23 pm
    Hi all,
    Need some advice. I have about a dozen images "mapped" to a background image (jit.qt.movie >> jit.gl.texture >> jit.gl.mesh). When they are in the background I want to use low-res versions of the images (mainly because photoshop does a much better job of scaling than QT/jitter), but when they are moved to the foreground I want to xfade to the high-res versions. I've tried a few options, such as trying to xfade sources of the textures (either via shader or jit.xfade), etc., but haven't been able to get it function right due to the different sizes of the matrices. So my current solution is to have two different textures with two different meshes, and play with the alpha values as they move between foreground and background. I've attached a patch showing what I'm doing.
    It works, but my question is: is this the most efficient way of doing this? It takes about a 10fps hit doing this on two meshes at the same time...essentially no hit on one. I know this is a perennial issue in game engine design, but have no idea how it's solved there...and how that might translate into a more efficient process in jitter than I am currently using.
    Thanks in advance for any help.
    Best, David

    • Apr 18 2011 | 6:00 pm
      The GL way of handling this would be to use MipMaps. To be honest, im not 100% sure if Jitter exposes that, or if it does, how you would build the MipMap group for the texture.
    • Apr 18 2011 | 10:17 pm
      There does seem to be some way via jit.gl.texture. In the reference it lists:
      mipmap symbol The mipmap interpolation mode to use. (default = none) Supported modes are: none nearest linear bilinear trilinear
      Beyond that, I have no idea how to use it. I'll poke around and see what I can find.
      Thanks for the hint!
      Best, David
      EDIT: it's even mentioned in the help file, but clearly you need to know what you are doing/what it's for beforehand.
    • Apr 18 2011 | 10:49 pm
      OK, so mipmap's are exactly what I need (thanks vade and wikipedia). And it looks like trilinear is the mode I want to use (xfade between textures of different resolutions). So now I just need to figure out how to: 1. load multiple textures (trying to decipher the "multi-texture-details" patcher in the help file to see if that's the path I take with this), and 2. what value to change to do the xfade.
      I'll keep plowing through the info I can find, but of course any addition pointers would be greatly appreciated.
      Much thanks, David