Interface Usage Open Inventor Interface Open Inventor Interface 1. Initialisation of Plotting Device NAG uses the subroutine named XXXXXX in all examples programs and documentation to represent the initialisation of your chosen plotting device. In order to initialise the Open Inventor NAG Graphical Interface you must call the supplied routine NAGIV. If you wish this may be incorporated into a subroutine named XXXXXX. A template, omitting any initialisation of variables, for routine XXXXXX might be: SUBROUTINE XXXXXX C LOGICAL BINARY CHARACTER*(*) FILNAM EXTERNAL NAGIV C CALL NAGIV(FILNAM,BINARY) C RETURN END where: FILNAM - indicates the destination of the Inventor output. If FILNAM specifies a file name, either an ascii or binary Open Inventor file will be generated. If only one frame of output is requested, then the output file will be stored as the specified name. If two ore more frames of output are generated, then the output files will be given the names FILNAM.n, where n is 1,2,... A maximum of 999 files may be generated in a single program run. If FILNAM = ' ', then no output file will be generated; instead, after completing the graphics, you may enquire the pointer to the root of the generated Open Inventor scene graph, so you may include this graph as part of some other Open Inventor scene graph. See Section 4. If FILNAM = '*', then no output file will be generated; instead, after completing the graphics, SceneViewer will be used to view the picture that was generated. THIS OPTION CAN ONLY BE USED WHEN GENERATING A SINGLE FRAME OF OUTPUT, as SceneViewer will take control of the application after it is launched. BINARY - indicates which type of output is to be generated: BINARY = .TRUE. - Open Inventor file in binary format will be generated, if file output is requested (see FILNAM). BINARY = .FALSE. - Open Inventor file in ascii format will be generated, if file output is requested (see FILNAM). 2. NAG Pens The four NAG pens are distinguished by line colour, line style and text font. Default pen settings: Pen 1 Pen 2 Pen 3 Pen 4 Colour 1 2 3 4 Line Style 1 2 3 4 Text Font 1 2 3 4 By default the current pen is pen 1. Note: some sites may have chosen to revise the default settings of NAG pens; you are referred to local documentation for details. Colours NAG Graphics sets up an initial colour table with 16 indices, each of which is assigned a distinct RGB colour definition. In addition 16 different shades of grey are also defined. By default, colours rather than monochrome shades are used for plotting. Line style The Open Inventor NAG Graphical Interface offers you a choice of four different line styles. You are referred to Figure 1 for an example of their appearance. Text Fonts The Open Inventor NAG Graphical Interface offers you a choice of 12 different Open Inventor fonts; as Open Inventor guarantees the presence of one font only, the actual number of fonts available depends on your Open Inventor environment. You are referred to Figure 1 for an example of the appearance of the fonts. Only one quality of Open Inventor fonts is available with this interface; therefore, calls to NAG Graphical Interface routine J06XFF with parameter IQUAL set to 1 or 2 will have the same effect. For details of the Hershey fonts (Hershey quality text), you are referred to the document `Available Hershey fonts'. Marker Styles Markers are generated directly by the NAG Graphical Interface. A choice of 9 marker styles is offered. Note: as only one quality of marker is available, a call to NAG Graphical Interface routine J06XFF will not affect the markers produced. NAG Brushes The Open Inventor NAG Graphical Interface only supports solid and patttern area fill; should you wish to use hatch fills you are recommended to use NAG simulated area fill styles. Due to the method used by Open Inventor to fit a pattern over an object, dependent on the aspect ratio of the area that is being filled, patterns are rotated over 90 degrees. Figure 2 summarises the area fill capabilities of the Open Inventor NAG Graphical Interface. Default brush settings: Brush number 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Colour 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Fill styles: Palette 1 (Open Inventor) All brushes are defaulted to solid fill Palette 2 (NAG) All brushes are defaulted to hatch fill Fill index 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 By default the current brush is brush 1 and the current palette is NAG simulated fill. 4. Additional Comments (a) In Open Inventor only the font size may be specified. This determines both the height and width of the character; no separate control of the character width is available. As such, in the call to NAG Graphical Interface routine J06XGF(WID,HGT) to set the width and height of a character, only the second parameter (HGT) will be used. As a consequence you may find that characters in a string may overlap, if the requested character spacing is incompatible with the character widths set by Open Inventor. If you wish to exert full control over the character size (height and width), you are advised to use the Hershey fonts. (b) If at initialisation FILNAM = ' ' is specified, then no Open Inventor output files will be generated, nor will the resulting picture be shown using SceneViewer. Instead, you may enquire the root of the scene graph generated by NAG Graphics, for example to include this as part of another scene graph. In order to achieve this, an additional NAG Graphical Interface routine, getNGLRoot, has been written. The following lines must be included in your C++ program: // Include the Open Inventor file // with the definition of the SoSeparator class #include // Specify the NAG Graphical Interface routine as extern extern SoSeparator *getNGLRoot(); You may then use the function, for example, in the following way: // Generate the picture in NAG Graphics . . j06wdf(); // To end a frame SoSeparator *nglroot; nglroot = getNGLRoot(); // Use the result . . // Generate the last picture in NAG Graphics . . j06wzf(); // To end the last frame and close NAG Graphics nglroot = getNGLRoot(); // Use the result . . Note: depending on the compiler you are using, Fortran functions may need an underscore (_) appended to their names when called from C. (c) Any output files generated by this interface, are generated directly by Open Inventor, and do not make use of any Fortran output channels. As such, specification of the Fortran command sequence channel by a call to NAG Graphical Interface routine J06VCF will have no effect. 5. Interface Number The value of IFACE output by NAG Graphics Library routine J00AAF for the Open Inventor NAG Graphical Interface is: IFACE = 32 6. Reference [1] The Inventor Mentor, Josie Wernecke, Addison Wesley, 1994.