The Elevator binary included on v6.1 of the Developer Toolbox was
generated on an IRIX 6.2 Indigo² Impact system.
In order to recompile you must install the GLUT 3.0 software,
included on this v6.1 Toolbox, onto your own system.
The inst images or tardist file can be found in
toolbox/src/exampleCode/opengl/GLUT/inst
README file from "src" directory
/* Author : Patrick Bouchaud galaad@neu.sgi.com */ PURPOSE: ======== A wide range of applications require mapping satellite photographs (2D texture) onto terrain elevation data (Geometry), and navigating over the resulting scene in real-time. AUTHORS's ticks : ================ I use 4-space tabulations (sorry for the printing) My Makefile first creates a .ofiles directory, where all the .o files go, and where the actual executable $(TARGET).EXE is generated. A $(TARGET) link is then created from the current directory to the executable. Libraries : =========== These Examples use P.Haeberli's libimage.a, and M.Kilgard's libglut.a. I assume these files are located under /usr/lib, and the image.h header can be found under /usr/include/gl, whereas the glut.h file should be under /usr/include/GL. COMPILER's DIRECTIVES: ====================== -DVARRAY : forces Vertex Array EXTensions to be used as drawing commands -DALTSHADOW : computes fake shadow colors for the non-textured viewing mode OPENGL EXTENSIONS: ================== CODE ARCHITECTURE : =================== The code is made of 4 separate modules : The Main module - Main.c, color.c The ColorMap Editor - editor.c The Culling module - editor.c 1) The Main module : -------------------- A.Interface with GLUT to open the main window, and handle associated callbacks. Read the elevation data, and generate color data relevant to the altitude, pseudo infinite light source positioning, and random perturbation (see color.c) The resulting geometry data are stored in a "Elevation Terrain[lat][lon]" array B.Launch YACME - Yet Another Colormap Editor, with the newLUTCallBack() callback function : This function is called by YACME each time a change is made to the colormap. We then redefine the current Texture Color Table, and the texture Detail Function according to the ALPHA curve. NOTE also that YACME is launched with a pointer to an initial LUT, which refers to a NULL array : hence the default YACME LUT is allocated. C. Owing to the current state of the IRIX-5.3 implementation of the detailed textures, and of the texture color table, EXTensions, we use the following textures depending on the current texture mode : Detailed Texture are activated with MIPMAP'd base textures. Both the detailed and base (and mipmap levels) textures have to fit in the texture memory The detailed and base texture have to have the same format Only GL_ADD detailing function can be used LUMINANCE textures always condition duplication of the red channel into the green and blue : the result is therefore always Black&White, no matter what the current texture color table can be. Owing to these considerations, when we're not in detailed mode, we reload a 1024x1024 texture with internal format GL_RGB8_EXT (to have actual lookup table capabilities). When we're in detailed mode, we load a base 512x512 MIPMAP'd texture - using gluBuild2DMipmaps(), and 256 detail texture. D. Finally, the main purpose of the Main module is to draw the geometry, using many different technics depending on the current drawing parameters - set by the user-interface. The drawing is actually driven by the Culling module, which is launched with a drawing callback function (stripArray(), or AfficheTexturedTerrain() or AfficheColoredTerrain() depending whether VERTEX_ARRAY is used, and depending whether texture is on or off) This callback function is supposed to draw a latitude=constante strip, with longitudes varying from lonmin to lonmax arguments. 2) The Culling Module : ----------------------- The culling algorithm is implemented as follow : We first get the vertex coordinates of the current viewing frustum pyramid. We record these coordinates in a geometry structure which is hierarchized as follows : vertex data <- edge data <- face data (a face is made of N edges, each edge being made of 2 vertice). We want to NOT duplicate the vertex coordinates, to make sure rounding errors will not make the geometry fall apart. Then we clip our viewing pyramid with the scene bounding box, i.e. considering a facetted volume is defined by a combination of plane inequations, we clip our viewing pyramid with each of the half spaces. Finally, on the truncated pyramid : We get the min and max latitude values for all the planes latitude=constant within [latmin, latmax] we compute the min and max longitudes of the lat=cst plane intersected with the truncated pyramid we call the callback function with (latmin, lonmin, lonmax ) (in fact we send the maximum limits with the previous strip) end for
Source
Documentation
Reference