Solid - Interactive 3D Graphics in SansGUI®




Introduction


In this example, we explore the new interactive 3D graphics features in the SansGUI Modeling and Simulation Environment and demonstrate how SansGUI supports OpenGL® graphics programming directly in Microsoft Visual C++ and Compaq Visual Fortran. With the solid foundation built in the SansGUI architecture, we introduced a new reference class, Graphics, that is capable of displaying 3-dimensional graphic objects using the OpenGL® Application Programming Interface (API), the industry standard for 3D graphics programming. As a simulation developer, you can use the OpenGL API directly in your simulation code, no additional layer of API is introduced by SansGUI. All the interactive user interface features, such as 3D object translation, rotation, zooming, and user selections, are handled by SansGUI, which packs these information in SansGUI data objects and passes them to your simulation routines.

This demonstration program simply allows users to operate on 3-dimensional objects displayed by the simulation routines that call the auxiliary library in OpenGL (GLAUX). The users can rotate the objects, drag the objects around, zoom into and out of the scene, print the 3D images, save the images to picture files in Bitmap or JPEG format, and run the simulation to constantly rotate the objects about the vertical (Y) axis. It also demonstrates the user interface control facility provided by the SansGUI Run-Time Environment. During a simulation run, the user can pause it, run single step, examine the values (angles), and plot the rotation angles on-the-fly, using the SansGUI dynamic charting mechanism. The user can even perform rotation, zooming, and translation of the 3D objects while the simulation is running.


Getting Started

A Quick Tour of Solid 3D Graphics Example (Local) - Click on the link to access the 3D graphics tour of the Solid example in the SansGUI Getting Started Guide.

Solid 3D Graphics Example from ProtoDesign (Web) - To access some screen shots and explanations of the Solid project from ProtoDesign's web site.

Official OpenGL Home Page (Web) - To enter the world of OpenGL® graphics programming.


Solid On-Line Document Pages

To understand how to integrate your own on-line, context-sensitive documentation structure into the SansGUI Run-Time Environment, as demonstrated in this document, please consult the Preparing On-Line Documentation section of the SansGUI Developer's Guide.

Solid Home Page (index.htm) - This Page.

Solid Simulation Control (SolidCtl.htm) - Explains the Cycle and External Process simulation control classes in the Solid example. The Cycle simulation control object contains control parameters that the user can customize. The External Process control is created merely to demonstrate how the textual model files can be created. There is no executable programs assigned to this external process simulator.

Class Graphics (Graphics.htm) - Contains reference information on class Graphics. Consult this page to learn how SansGUI incorporates OpenGL 3D Graphics and supports OpenGL API programming.

Class Graphics.Solid (Solid.htm) - Contains reference information on class Solid.


Acknowledgements

The Solid example uses aux{Wire|Solid}* 3D object drawing routines in the OpenGL Auxiliary Library from Silicon Graphics, Inc. The original GLAUX.LIB distributed with Microsoft Windows contains quite a few bugs in these drawing routines and was compiled and linked with using single-threaded libraries option. It caused abnormal drawing behavior and C run-time library routine conflicts in the Solid example. We would like to thank Richard S. Wright, Jr., the author of OpenGL SuperBible, for sending us the GLAUX source code with his bug fixes and his permission to redistribute the fixed code. We have created a project workspace in Microsoft Visual Studio and rebuilt the library with the Multi-threaded DLL option set so that the C run-time library will not be conflicted. The newly built GLAUX.LIB can be found in the sys subdirectory of the SansGUI installation directory. You should backup the old GLAUX.LIB and use the new one if you would like to rebuild Solid or create any project that uses GLAUX. The source files of GLAUX are included in a zip file named GLAUXM.ZIP, which can also be found in the sys subdirectory.


References

Fosner, R. 1997. OpenGL Programming for Windows 95 and Windows NT, Addison-Wesley, Reading, Massachusetts.

Lawrence, N. 2002. Compaq Visual Fortran: A Guide to Creating Windows Applications, Digital Press, Boston, Massachusetts.

Woo, M., Neider, J., Davis, T., and Shreiner, D., OpenGL Architecture Review Board. 1999. OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 1.2, 3/e, Addison-Wesley, Reading, Massachusetts.

Wright, R. S., Jr., and Sweet, M. R. 1999. OpenGL SuperBible, 2/e, Waite Group Press, Corte Madera, California.


Technical Support

support@protodesign-inc.com


Copyright © 2003 ProtoDesign, Inc.
Last updated: June 30, 2003