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
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.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
glEnable(GL_ALPHA_TEST) glAlphaFunc(GL_GREATER, 0.25)
Example: crayoland.py vs alphatest.py
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
