3D Viewports

A 3D viewport specifies where we want to draw 3D objects in the active virtual buffer. To set up a 3D viewport, we use the fg_3Dviewport() function. Its first four parameters are the minimum x, maximum x, minimum y, and maximum y screen space coordinates defining the viewport edges within the virtual buffer. These can define any rectangular region but are often set to the virtual buffer extents. The final fg_3Dviewport() parameter is the projection ratio. This is a non-zero floating point value by which 3D coordinates are multiplied before projection (the projection ratio is often 1). For example, the statement





Visual Basic:

Call fg_3Dviewport(0, fg_getmaxx(), 0, fg_getmaxy(), 0.5)

defines a 3D viewport equal to the virtual buffer resolution with a projection ratio of 0.5.

If the projection ratio is positive, Fastgraph will use a left-handed 3D coordinate system; if negative, Fastgraph will use a right-handed coordinate system. Since Fastgraph's 3D geometry system uses a left-handed coordinate system, you'll almost always specify a positive projection ratio. A negative projection ratio (that is, a right-handed coordinate system) might be useful during conversion of programs that use Fastgraph's legacy 3D functions, but bear in mind that not all features of the 3D geometry system (for example, 3D clipping) will be available if you use a right-handed coordinate system.

<< Prev

Next >>

Fastgraph Home Page


copyright 2001 Ted Gruber Software, Inc.