Textured Mesh

When applying a texture across a mesh, or collection of polygons, vertices that correspond to the same point should have the same texcoord.

Example: mesh.py




Texture Alpha

Use 4 channel texture image

Can be used to "cut out" a texture image - creates complex shapes with simple geometry

RGB Alpha
        

Example: texalpha.py






addalpha

addalpha.py can combine an RGB color image with a greyscale alpha image into a single file, for use as a texture

Output file should be TIFF, for 4-channel support

         





Alpha Test

GL_ALPHA_TEST provides simple binary transparency (fully transparent or fully opaque), without drawing-order concerns.

  glEnable(GL_ALPHA_TEST)
  glAlphaFunc(GL_GREATER, 0.25)

Example: crayoland.py vs alphatest.py

       




Texture from Web

Python's urllib or urllib2 can be used to fetch web data.

e.g. textures or sounds

    try:
        webdata = urllib2.urlopen(url).read()
    except:
        return None
    webdataAsFile = StringIO.StringIO(webdata)
    tex = Texture2D(webdataAsFile)

Example: texURL.py



Creative Commons License
This document is by Dave Pape, and is released under a Creative Commons License.