Re: 2D Textures

New Message Reply Date view Thread view Subject view Author view

Michael Jones (mtj++at++babar)
Sat, 21 Jan 1995 08:04:55 -0800


On Jan 20, 9:08pm, Darin C. Partridge wrote:
> Subject: 2D Textures

:All I want to be able to do is not supply performer any texture coords
:and just let performer figure out how to apply it.

Three approaches seem evident:

1. Generate texture coordinates in the loader itself. If there is
    a functional mapping between vertex location and texture
    coordinate for each texture, then simply add support to the
    loader. Where the loader is ready to add the polygon to the
    pfuBuilder, just do:

        for (v = 0; v < numVerts; v++)
        {
            polygon->texCoord[v][0] = whateverSFunction(this x,y,z)
            polygon->texCoord[v][1] = whateverTFunction(this x,y,z)
|

2. Generate the texture coordinates after the file is loaded by
    a scene-graph traversal. If you can't do it in the loader (for
    example because you want to remap all textured objects in
    the MultiGen loader) you can perform a traversal of the
    scene graph (look at trav.c in the utility library) and change
    or generate new texture coordinates for any or all geosets.

    Sample code for this would look like a cross between the
    fragment above and the function pfuMakeTexList.

3. Generate the texture coordinates in the hardware's Geometry
    Engines using texgen. The texgen(3G) man page has the full
    details of this method. Your pre- and post-draw callbacks
    just need to enable and disable texgen as desired to perform
    the desired mapping.

-- 

Be seeing you, Phone:415.390.1455 Fax:415.965.2658 M/S:8U-590 Michael T. Jones Silicon Graphics, Advanced Graphics Division mtj++at++sgi.com 2011 N. Shoreline Blvd., Mtn. View, CA 94039-7311


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:52 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.