Friday, December 21, 2007

DSO Example

In the exampleDSO.tar.gz you'll get the files:
exampleDSO/
exampleDSO/GNUmakefile
exampleDSO/exampleDSO.cpp

untar it, cd to exampleDSO, type
make and run the DSO. (Don't forget to have dgl-config and dtk-config in
your $PATH.)

You can then run it using the command:
> export DGL_DSO_FILES=desktopGroup
:exampleDSO
> dosg-fly --examine cow.osg

The DSO doesn't do much except print out the size of the first graphics
window, but does show you how to get the the Producer::RenderSurface
corresponding to the window, which might be handy. Eventually you'll want
to get all render surfaces for all windows, but we can deal with that later.

Here's an example of using a different DSO to get different behavior, and
might be handy for testing with multiple windows:
> export DGL_DSO_FILES=desktopGroup:hyperDisplay:exampleDSO
> dosg-fly --examine cow.osg

This DSO doesn't have every single callback used- it's not clear what
callbacks you need, and what you want the DSO to do. Let's get this one
working first, then later when the DSO's functionality is defined, I can
help you add more callbacks if they're needed.

If you need to add a DSO to the DIVERSE package itself, send it to me and
I'll test it and install it in DIVERSE for you. I think this would be saner
than you trying to mess with the DIVERSE package itself.

Wednesday, December 12, 2007

CCallBackHelix DTK Issue

We would like to have some information on how keyboard and mouse are controlled in the "CCallbackHelix" example.

When a mouse button is pressed, information on this button is displayed in the terminal
This is achieved by the pointer "button" from the line:

dtkInButton* button = (dtkInButton*) DGL::getApp()->get("buttons", DTKINBUTTON_TYPE);

We would like that mouse control is no more done this way but rather through Qt. We are currently writing a small application in Qt and when a mouse button is pressed on the Qt Window, mouse information is displayed on the terminal. We'll then try to implement this on the "CCallbackHelix" example.

We expect to have the following if we succeed:
- A window created with Qt in which we will display the Helix
- Mouse and keyboard events will be controlled in Qt

Questions
- Is the Producer API used to control the mouse in the "CCallbackHelix" example or is it through DTK?

------------------------------------------------------------------------------------------------------------------------------------
John replied:

When DIVERSE was first written, it ran only on X11 based systems such as
Linux and IRIX. DTK created some classes which use X11 to read the
keyboard, mouse and mouse buttons. When DGL was written by Andrew, he
decided to use Producer to handle the keyboard, mouse and buttons (and also
windows). He felt this would be the easiest way to support non-X11
platforms.

Except for bug fixes, DTK is basically a "frozen" project. The original DTK
developer is no longer around, so we pretty much use DTK as is. New
functionality is written in DGL.

Andrew came up with a way in DGL to feed data to DTK using Producer, so the
old X11 DTK code would still work. For example, the DTK trackballNav DSO
works with DGL's Producer code stuffing the mouse and buttons, but is
unchanged since it was originally written to use DTK's X11 code.

This is done in the DMKCallback class in the files
diverse/dgl/libs/dgl/DProducer
InputCallback.cpp and
diverse/dgl/include/dgl/DProducerInputCallback.h.

Other little DGL-only utility classes exist too: DGLKeyboard, DGLMouse,
DGLMouseButton. DTK doesn't use them, but they do use Producer.

Take a look in the DGLWindow class, and look for "DMKCallback". You'll see
it get set up in the postRealize() callback, and called every frame in the
updateKM() callback.

Monday, November 26, 2007

Testing installed software

John said:
-------------
The project as envisioned does not need DIVERSE's dpf or dads. It also
does not need CoVE.

As dpf isn't needed, neither is OpenGL Performer. OpenSceneGraph is only
needed if you choose to use dgl's dosg component. Inventor is also
optional.

The dgl example program "CCallbackHelix" should be sufficient to test your
software using different DSOs to describe various window configurations.
DSOs are also used to read the keyboard and mouse. You may choose to write
some of your own DSOs to print more verbose information about the state of
the system's windows and keyboard and mouse events.

The project in a nutshell is to replace the Producer component of dgl with
Qt, which is used to create and manage windows, and read from the keyboard
and mouse.

Thursday, October 25, 2007

Some Diverse Background

First, here's the model that DIVERSE uses for managing displays. It is a
series of nested class objects. Objects of one class contain one or more
objects of other classes.

At the top level is a class called "pipe". There is one pipe object per
graphics display. In our RAVE there are four pipe objects, one for the console
and three for the RAVE walls.

Contained in pipe each object are one or more "window" objects. A window is
a rectangular area of the pipe, and is managed by the window manager. A
window can have window decorations, be moved/raised/lowered, and can overlap
other windows. A window can be either stereo or mono. Our RAVE has one
window object per pipe.

Each window object contains one or more "screen" objects, and each screen
object is used to describe a viewing frustum. In our RAVE, the desktop
window's screen object has a symmetric frusta, and is described in terms of
field-of-view and offset from the origin. Each wall of the RAVE has a
screen object with a head-tracked asymmetric frustum described by the
physical size and position of a RAVE wall.

Each screen object contains one or more "viewport" objects. A viewport is a
rectangular area of a window which is the base of a screen object's frustum.
In our RAVE, the desktop screen has a viewport occupying the entire window.
The RAVE's front and left walls have viewport objects which leave the left
and right few inches of the window unmapped, and a floor viewport which uses
the entire window.

These set of nested classes can be used to describe any virtual environment
hardware display configuration.

How does this relate to Producer? Producer is used by DIVERSE to create
windows and viewports within the windows, and to access the keyboard and
mouse in a device independent manner.

Producer uses a very different model than DIVERSE. See
http://www.andesengineering.com/Producer/Tutorial/index.html for a nice
picture called "Sorting Out the Terminology".

Producer has a class called "SceneHandler" which is hook into the
three-dimensional scene. The scene is captured by an object of the "Camera"
class. The Camera has objects of the "Lens", "ProjectionRectangle" and
"RenderSurface" classes.

The Camera has a position in the world. The Camera's Lens object calculates
the view frustum, and the base of the frustum is a ProjectionRectangle. The
ProjectionRectangle is placed on the RenderSurface.

Additionally, Producer provides the "KeyboardMouse" class to access the
keyboard and mouse.

Here is how DIVERSE use Producer:

Every viewport object in DIVERSE creates an object based on the Producer
SceneHandler class. That is, every DIVERSE viewport is a picture of the
three-dimensional scene. Every viewport object also creates a Producer
Camera object, as it needs to project the three-dimensional scene onto a
two-dimensional viewport rectangle. The Camera contains a Lens,
RenderSurface and ProjectionRectangle. The attributes in the DIVERSE
classes are used to set the attributes of the various Producer classes.

Producer has some higher-level classes which we have been unable to get to
work in a multi-pipe multi-processor threaded environment. The "CameraGroup"
is not used, as we could not get it to work in a multi-threaded environment.
Therefore, we manage individual cameras and provide our own threading code.
Threading is probably our largest problem with Producer.

DIVERSE uses Producer's KeyboardMouse class to access the keyboard and mouse
devices. Although Producer's aim is to provide a platform independent API,
some methods are only implemented in X11, such as cursor positioning. It
would be desirable to have an API that is truly platform independent, so
DIVERSE could be used on all supported platforms- Linux, OS X, Windows.

The purpose of the project is to investigate if Qt can be used a replacement
API for Producer. This will require:

1) Learning about Qt's capabilities

2) Learning about DIVERSE's needs in a windowing package

3) Determining if Qt can be used to replace all of the functionality
provided by Producer. Also to determine if Qt can be used to offload
some of the functionality coded into DIVERSE, such as multi-threading and
device independent keyboard/mouse access.

4) Programming the changes to DIVERSE

5) Testing in various environments for correctness and speed

==================================================================================
DIVERSE is comprise of several packages.

DTK, the DIVERSE toolkit, is contains utility functions and base classes.
It contains no graphics code. Two classes are referenced here:

A dtkAugment object contains specific predefined callbacks.

The dtkManager class implements a callback manager by loading objects based
on the dtkAugment class, and invoking their callbacks at specific times.
dtkAugment objects can be loaded into the dtkManager object via a load()
method inside of an application, or as is more often the case, by creating a
DSO object and having the dtkManager object load the DSO at run time.

All the FLTK code is used by DTK applications, so for the Producer to Qt
port, FLTK isn't in the picture either.

DGL, DIVERSE for OpenGL, creates a single object of the DGL class. The DGL
class is based on the dtkManager class. It defines additional callbacks
commonly needed by graphics applications. Since the DGL object is a
"singleton" it uses static data and methods to make it easier to use.

DGL also provides the dglAugment class, based on the dtkAugment class.
Objects based on either the dtkAugment or dglAugment class can be loaded
into the DGL object.

DGL also has other classes used to define windows, get input, calculate view
frusta and so forth. It is in these other classes that all of the Producer
code is contained.

All of the graphics display configurations and user interactions are
specified with DSOs loaded at run time. This allows a single application to
run on a variety of hardware, or with different user interactions, without
modification.

DOSG, DIVERSE for OpenSceneGraph, is a class based on dglAugment. Its
callbacks are invoked by the DGL object. All of the OpenSceneGraph code is
in the DOSG class. None of your work will involve modifying DOSG.

Back to Producer-

Here are all of ther DGL classes that use Producer, and what Producer
classes are used:

> find . -name \*.h | xargs grep include | grep 'Producer'
./dgl/DGLCameraThread.h:
#include
./dgl/DGLWindow.h:#include
./dgl/DGLWindow.h:#include
./dgl/DProducerInputCallback.h:#include
./dgl/DGLScreenHandler.h:#include
./dgl/DGLOrthoHandler.h:#include
./dgl/DGLViewport.h:#include
./dgl/DGLDisplay.h:#include
./dgl/DGLPerspectiveHandler.h:#include


Tuesday, October 2, 2007

Getting started

Here is a list of things to get started.


1. go to http://www.google.com/ and click on 'more' and select 'Blogger'

Set up a blog for this project and let us know the details so we can
subscribe.
Please post in English so we can read it.
Also, send us the URLfor the site, and the URL for its RSS or
equivalent feed.

We will use the blog to keep track of the project.

2. Install the CentOS Operating System: http://www.centos.org/
We are using version 5

3. Install Producer - http://andesengineering.com/Producer/

4. Install Open Scene Graph (OSG) - http://openscenegraph.org
We're currently using version 2.1.

5. Install FLTK - http://www.fltk.org
DIVERSE uses fltk version 1.1.7

6. Install Diverse - http://diverse-vr.org

7. Send all questions to john.kelso@nist.gov, and me
judith.terrill@nist.gov. Please cc schanzle@nist.gov
The DIVERSE web pages are in the middle of a rewrite for the next
release of DIVERSE.
After that is completed, we will notify you and you can subscribe
to the DIVERSE Producers list

8. Install Qt- if you can support both versions 3.3.6, (which is what
comes with Centos), and 4.3.1, the most recent version, it would be
best.
If you have to choose just one, choose 4.3.1, as eventually Centos
will catch up.