Graphics.DisplayContext - lordmundi/wikidoctest GitHub Wiki

Customizing the view layout

« Advanced Lighting Effects | EDGE User’s Guide | Using the simdata plugin for data playback »

The base release comes with a default display context. The display context is a block in the config file inside the "DISPLAY" block that defines how EDGE should look. This can include what GUI scripts are included, what plugins are loaded, and what command line options are used. But, most importantly, it can define the channel definitions (the actual view windows).

The base release comes with a single display context called "ENG_GRAPHICS" inside cev.cfg. This display context defines all of the items listed above that are specific to that context.

But what if you want to customize your look and feel for you and/or your customers? Well, that's what this page is all about.

Simple Instructions

To create a new display context:

  1. Edit "${USERDATA}/user.cfg". Rename the included ENG_GRAPHICS skeleton display context (under DISPLAY) to the name of your choice.
  2. Add in your own GUI, plugin, and command line elements that you want in your context. You may want to start with the ones included in the base ENG_GRAPHICS context in cev.cfg as a starting point and remove those that you don't want.
  3. Customize the channel viewport definitions
  4. Remove the multidisp.tcl GUI element from the display context (if you copied it over from cev.cfg) since it is specific to the base context.
  5. Re-run EDGE and a display context chooser dialog will appear since more than one is defined (NOTE: Future versions may not show the dialog, but this can be set on command line with the -display option - see below)

What's really going on

By creating your own display context, you are defining the entire look and feel of the GUI, including menu items, view layout, and plugins/command line options.

In the base release, the default "ENG_GRAPHICS" display context has a channel definition that is defined with specific names, such as view.MAIN, view.MUXL, view.MUXR, etc. This is because the included gui script known as "multidisp.tcl" is assuming those display names so it can switch between them.

NOTE: If you plan on using multidisp.tcl as the basis for a customized version to switch between your different view configurations, you should remove all references to the "curdisplay" variable. There is a known issue in 1.0 where doug.tcl checks this variable for multidisp existance which can be triggered if you use a modified version of the script. Remove all references to it and use a different variable to work around this issue if you decide to do this. This will be fixed in subsequent releases. Thanks to smermel for reporting this. —FG

The multidisp script is manifested in the Display menu and let's you switch between one view, two views, and three views. The default channel definition in cev.cfg probably looks similar to the following:

channel1
 {
    view.MAIN   CM_Cam    perspective( 40.9, 1.333, 4.0, 1000000000000.0 ); xywh( 0, 0, 640, 480 ); attribs(CAMINFO);
    view.MUXL   CM_Cam    perspective( 40.9, 0.666, 4.0, 1000000000000.0 ); xywh( 0, 0, 320, 480 ); attribs(CAMINFO,HIDE);
    view.MUXR   RocketCam   perspective( 40.9, 0.666, 4.0, 1000000000000.0 ); xywh( 320, 0, 320, 480 ); attribs(CAMINFO,HIDE);
    view.LEFT_TOP   CEV_CDR_Eyepoint perspective( 40.9, 1.333, 4.0, 1000000000000.0 ); xywh( 0, 240, 320, 240 ); attribs(CAMINFO,HIDE);
    view.RIGHT_TOP CEV_boresight perspective( 40.9, 1.333, 4.0, 1000000000000.0 ); xywh( 320, 240, 320, 240 ); attribs(CAMINFO,HIDE);
    view.BOTTOM JimboCam perspective( 40.9, 2.666, 4.0, 1000000000000.0 ); xywh( 0, 0, 640, 240 ); attribs(CAMINFO,HIDE);
 }

These are the fields you will want to customize to display a new view layout. The fields are as follows:

view.<name> <camera> perspective( 40.9, <aspect_ratio>, <near_clip>, <far_clip> ); xywh( <x>, <y>, <w>, <h> ); attribs(CAMINFO);
  • name = name assigned to the viewport
  • camera = the initial camera assigned to the view
  • aspect_ratio = the aspect ratio of the viewport (will be enforced if a camera type is defined for the camera)
  • near_clip = the near clip/clipping plane in inches - do not set any lower than needed as it can kill performance!
  • far_clip = the far clip/clipping plane in inches - no harm in setting larger
  • x,y,w,h = the start x, start y, width and height, in pixels, of the view window
  • attribs() = adding "HIDE" to the attribs will cause the viewport to be initially hidden. Can be unhidden by a tcl script.

NOTE: The start x and y are coordinates referenced from the bottom left corner of the screen (openGL coordinate system). BUT, these are overridden when running with the "-center" command line option, which is defaulted in many versions and will center up the view window.

When running with "-center", you can use the "-xoff" and "-yoff" command line options to position the window relative to the center. If you don't use the "-center" option, then the start x and y specified in the view line will be honored for each viewport and then a window will be drawn to encompass all of them. This can be helpful when you want a viewport to be drawn in a specific portion of the display to be captured by a video capture device.

Understand that in the end, all of this is just "requested" from the window manager, and different window managers and different settings may behave differently. For some cases, the Fullscreen Helper script may give you the control you want for the position of the window.

frankie April 14, 2010, at 06:45 PM

For example, a bare display context definition with a single view:

EXAMPLE
 {
    DOUG
    {
         GUI
         {
             blipper ""
         }
    }

    command_line
    {
        -noborder
    }

    plugins
    {
    }

    channel1
    {
        view.MAIN   CM_Cam    perspective( 40.9, 1.333, 4.0, 1000000000000.0 ); xywh( 0, 0, 640, 480 ); attribs(CAMINFO);
    }
 }

In this example, a single view is defined to default to CM_Cam and the "-noborder" argument is passed on the command line to tell EDGE to not draw any window decorations. Also, the "blipper" gui element is redefined to a null string to remove the blipper menu (the main menu) from the display.

NOTE: Don't use the camera "JimboCamRms". This camera is broken and will be deleted from future releases. —FG

NOTE: Don't set -noborder and -fullscreen until you 1st resolve all of the multiple tcl error messages that occur. Any tcl scripts that reference blipper will also need to be redefined NULL as well, otherwise EDGE will appear to hang up forever because a tcl error pop up has popped under EDGEs main window and you can never respond to what you can not see or have access to. — myount

After customizing your new display context and re-running, you should notice a display context chooser.


EDGE Display Context Selection Dialog

This appears because more than one display context is available and one has not been preselected. If you want to avoid this dialog, pass the display context name to EDGE using the "-display" command line option. Note that this should be in a the "DSP_CONFIG → DOUG → GUI → command_line" block and not the display context command_line block. For example, we can default to the EXAMPLE display context in user.cfg by setting the following:

— top of user.cfg —

DSP_CONFIG {

DOUG
   {
       # Add or remove elements here that are included with EDGE
       # regardless of display context.  This is a good place for
       # standard menus that provide basic functionality and are not
       # simulation or facility specific
       GUI
       {
       }

       command_line
       {
           -display EXAMPLE
       }
   }

« Advanced Lighting Effects | EDGE User’s Guide | Using the simdata plugin for data playback »

⚠️ **GitHub.com Fallback** ⚠️