Integrated 2D and 3D graphics

To draw a graphic, you create it and call its Draw function. The Draw function takes the address of the drawing port as a parameter. You can draw 2D and 3D graphics into the same drawing port. When 2-D and 3-D graphics are drawn together, you set the camera, lights, and atmospheric attributes necessary for 3-D rendering in the drawing port as the scene bundle. Camera defines from what vantage point the 3-D graphics are viewed (front, side, back), light defines which portions of the graphics are illuminated and from what direction, and atmosphere adds a haze or fog to the scene.

Any 2-D graphic can be converted to a 3-D graphic by going through the 2-D and 3-D curve constructors. You might want to convert a 2-D graphic to a 3-D graphic if your application requires that the 2-D graphic also be affected by scene attributes.

When you draw 2D and 3D graphics, you use the 2D coordinate system to specify the points of a 2D graphic, and the 3D coordinate system to specify the points of a 3D graphic. Because the y-axis goes up in the 2-D coordinate system and down in the 3-D coordinate system, some confusion may arise as you code. You can adjust either the 2D or the 3D coordinate system so that the y-axes go in the same direction as follows:

2D: Transform the 2D graphics so that their y values are opposite. Positive y values become negative and negative y values become positive.

3D: Move the 3D camera so that the 3D y-axis points down like the 2D y-axis.

The display device for the graphics is a 2-D coordinate plane, whether it be a monitor or a printer. Drawing 2-D graphics to a display device is straightforward. But drawing 3-D graphics to a display device requires calculations so that the correct location for the z coordinate values has to be found so that the 3-D graphic looks correct. These calculations are performed for you based upon the camera settings. See Chapter 17 for more information on cameras and converting z coordinate values to the 2-D coordinate plane.

In addition to drawing 2-D and 3-D graphics together in the same drawing port, any 2D or 3D graphic created in one CommonPoint application system program can be transferred to another CommonPoint application system program by way of the clipboard. It makes no difference which program created the graphic. Transferred graphics can be added to, deleted from, and otherwise manipulated in the programs to which they have been transferred.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker