Table of Contents

Module: pack_textures rdpyg/util/pack_textures.py

TODO: need to return UV coordinates and pixel coordinates for the packing/cutting functions for where the images are located on the textures.

Code to pack multiple textures into larger ones. As well as to cut up bigger textures into smaller ones.

This is useful for eg opengl where there are textures size limits. Also it can speed up rendering as you need to do less texture binding calls, and you can reduce geometry calls too.

Power of 2 textures can be a waste of memory if you have non power of 2 sized images. The more video memory saved the faster a game can go.

To make this code more useful it will work with rectangles. So that it can be used to update texture memory as well as to update images.

There will also need to be possibly multiple big output textures. So that you can specify a maximum size output texture.

Functions   
pack_images_into_multiple
split_big_image
  pack_images_into_multiple 
pack_images_into_multiple (
        small_list,
        max_size,
        use_pow2=1,
        )

returns a list of Texture objects with the textures from the small_list packed into them. small_list - list of Texture objects max_size - of the output Textures. use_pow2 - if 0 then we do not have to limit ourselves to power of 2.

Exceptions   
NotImplementedError
  split_big_image 
split_big_image (
        big_image,
        max_size,
        use_pow2=1,
        )

returns a list of Textures which the big_image is split into. big_image - a Texture object.

TODO: how to determine where the small bits are placed?

Exceptions   
NotImplementedError
Classes   

Texture

One texture which holds multiple smaller ones packed in.


Table of Contents

This document was automatically generated on Sat Jul 30 12:45:42 2005 by HappyDoc version 2.1