1. An OpenGL framework for win32

  2. Background
Required resources
  1. Running opengl.win_prototyping_main.exe
    1. Required Hardware
      Required Software

    Software development

    1. Required Hardware
      Required Software
  1. The main program opengl.win_prototyping_main.exe
    1. Interactions with mouse and keyboard
    2. Command line parameters
      1. -test
      2. -timer
      3. -timerfontsize
      4. -timing
      5. -timerdelta
      6. -clock
      7. -clock24h
      8. -earthscale
      9. -earth
      10. -earthfile
      11. -timeoffseth
      12. -timefactor
      13. -earthloc
      14. -lat -lon
      15. -anti
      16. -mouse
      17. -fullwindow
      18. -windowx -windowy -windoww -windowh
      19. -background
      20. -fontinfo
      21. -nologfile
      22. -showerrors
      23. -priority
    1. Setting the command line parameters
  1. Implementation details
    1. The Package structure
    2. Adding new classes
  2. Compiling and Linking with GNAT
  3. References


The program described in this document is a side product of a larger OpenGL application developed at AMST-Systemtechnik/Austria in 1998/1999. This application is used in different flight simulators to display the instrument panels of the simulated aircrafts. The author used the framework this software is based upon to develop some nice applications in his spare time.

First, the required hard- and software is given. Then the configuration of the main-program using the command line is presented. The software-structure is shortly described in a last paragraph in order to be able to implement extensions using the given or new classes.

Required Resources

The Software was developed on PCs using windows for the target being also windows.

Running opengl.win_prototyping_main.exe

Required hardware

Basic-hardware:    PC with fast Pentium- or AMD-processor
Graphics card:      Fire GL or ELSA Gloria XL

For fast frame updates of more then 30 Hz a fast processor (> 300 MHz) and a graphics card with OpenGL acceleration is recommended. For software development frame updates of about 5 Hz (without antialiasing) are achievable without special OpenGL hardware.

Required software

Operating system:	Windows NT / 95 / 98 / 2000 / ME
Executable:		opengl.win_prototyping_main.exe 
DLL's:                	(Dynamic Link Libraries) opengl32.dll und glu32.dll. 

Software development

Required hardware

PC with fast Pentium- or AMD-processor

Required software

Operating system:	Windows NT / 95 / 98 / 2000 / ME
Ada compiler:		ObjectAda for Windows native Version 3.1.1, 3.1.2 (or later), 
                             	 (GNAT Version 3.13p for WinNT) 
Libraries:		Win32Ada binding (includes OpenGL binding) 
DLL's:             	   	(Dynamic Link Libraries) opengl32.dll and glu32.dll. 

The main program opengl.win_prototyping_main.exe

For test purposes simple interactions can be made with Opengl.win_prototyping_main.exe using mouse and keyboard. The command line is used to set options and to select an application.

Interactions with mouse and keyboard

Left mouse button, key-up, key-down and characters
With the 3 mouse buttons and some keys the application may be manipulated. The corresponding callbacks are in the package bodies of opengl.win, opengl.clock, opengl.earth.

Command line parameters

There are 3 types of command line parameters:

example: -timer.
example: -timerfontsize 3. Numbers may be given as integers or floating-point values.
example: -bmpfile \ada95\pictures\adalogo-new-small.bmp .

The following command line parameters are defined for opengl.win_prototyping_main.exe (see package opengl.command_line):

Count:              123456     Time: THURSDAY  FEBRUARY  04, 1999, 13:13:55:00 : no network-update since 3.4260 sec.
Dt [ms]:            25.123
E[Dt] [ms]:       24.123
Max[Dt][ms]:    33.456
An executable generated with GNAT3.13p uses the string Ada.Exceptions.Exception_Information(E) & Gnat.Traceback.Symbolic.Symbolic_Traceback(E) to display the exception_occurence E (see package body portable.utils).


Setting the command line parameters

The command line parameters can be set best in windows-connections. The following figure shows an example connection.


Implementation details

This paragraph gives a short overview of the package structure and some hints for adding new classes.

The package structure

The package structure is reflected by the following directory tree:

\ada95\source\projects\opengl\windows        Microsoft-windows specific software
\ada95\source\projects\opengl\kernel          reusable components

The sources for opengl.win_prototyping_main are all given in the hierarchical package opengl. The child packages of opengl.models contain all reusable graphical components. Together with other reusable parts they can be found in the kernel-directory

The Microsoft-windows specific parts can be found in the packages opengl.win, opengl.fonts, etc. in the windows-directory which contains also the main program.

The software uses some packages from an Ada-library of reusable components given in the following directories

\ada95\source\lib\math          Generics for basic vector- and matrix-algebra etc.
     OS- and windows-specifics, win32-addons, posix-bindings etc.
        Some utilities and components (hash, stack, etc.)

Adding new classes

If you want to add new graphical objects you should write new child packages of opengl or opengl.models containing new types in the models.model_2d_z or model_3d class tree and render-procedures for them or you could generate sibling packages of opengl.models if appropriate.

To test these classes adapt the package-body of opengl.test_screen_prototyping, where you define all graphical objects that shall be displayed. As shown there you can define new command-line parameters to select these objects without recompiling and relinking the main.


Compiling and Linking with GNAT

When extracting the zip-files lib-src.zip and ogl-src.zip you should use the full pathnames. The following directory structure is created:


\ada95\bin\gnat -- .o,.ali,.exe

\ada95\compiler\gnat -- GNAT installation

\ada95\source\lib\math\arrays -- lib-src.zip



\ada95\source\projects\opengl\config-files -- ogl-src.zip





AdaGide 6.26 and GNAT 3.13p may be used. To use AdaGide open \ada95\bin\gnat\ opengl-win_prototyping_main.ads and link. The gnat.ago file is used which containes all necessary include-paths and references all object-archives. When you have installed GNAT in a different location then \ada95\compiler\gnat\ you have to adapt gnat.ago first. The link command will install all '.o', '.ali', '.exe' files in \ada95\bin\gnat.

To execute \ada95\bin\gnat\ opengl-win_prototyping_main.exe execute one of the files clock-fn, clocks, earth, in \ada95\source\projects\opengl\config-files. If you want to use the ObjectAda-executable contained in opengl.win_prototyping_main.zip instead of the GNAT one you have to adapt the 3 files before, cause the OA-exe uses a '.' in the filename instead of a '-'.



The bitmap that is used for the 2D texture for the earth is taken from the following source


and slightly modified. The Ada-Excellence image is taken from the Ada-power side.