Page 362 OpenGL Super Bible! Figure 10-1 The (Free web hosting music)
Sunday, September 30th, 2007Page 362 OpenGL Super Bible! Figure 10-1 The hex bolt to be modeled in this chapter Choosing a Projection Before we start constructing, we need a projection, a frame of reference for placing the objects. For an example like this, an orthogonal projection is the best choice. This is a typical choice for applications such as CAD, in which an object is being modeled and measured exactly. This bolt has a specific width, height, and number of threads and is comparatively small. Using a perspective projection would make sense if we were modeling something larger such as a landscape, where the effect would be more apparent. Listing 10-1 is the code that creates the viewing volume. It creates an orthogonal projection and represents a coordinate system that reaches 100 units along the x- and y-axis. An extra 100 units is supplied along the z-axis where the viewer will be located. Listing 10-1 Setting up the orthogonal projection for this chapter s examples // Change viewing volume and viewport. Called when window is resized void ChangeSize(GLsizei w, GLsizei h) { GLfloat nRange = 100.0f; // Prevent a divide by zero if(h == 0) h = 1; // Set Viewport to window dimensions glViewport(0, 0, w, h);
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.