osgGtk logo

osgViewer::ViewerGtk Class Reference

Extends Viewer with several Gtk specific aspects. More...

#include <osgGtk/ViewerGtk.h>

List of all members.

Public Member Functions

 ViewerGtk ()
 ViewerGtk (osg::ArgumentParser &arguments)
 ViewerGtk (const osgViewer::Viewer &viewer, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
virtual ~ViewerGtk ()
 If running, stops the viewer.
virtual bool isSameKindAs (const osg::Object *object) const
virtual const char * libraryName () const
virtual const char * className () const
GraphicsWindowGtksetup_viewer_in_gtk_window (int width, int height)
 Sets up this viewer to run in a Gtk window of the specified width and height.
virtual int run ()
 Starts the viewer running at the currently set frame interval and priority.
int run_to_frame (int frame_num)
 Runs the viewer until the viewer's OSG frame stamp reaches frame_num.
int run_frames (int frames)
 Runs the viewer until the viewer's OSG frame stamp reaches the current frame stamp + frames.
virtual void stop ()
 Stops the viewer from running.
bool is_running ()
 True if the viewer is running, false otherwise.
double fps ()
 Returns the frames-per-second rate based on the currently set frame interval.
void set_fps (double fps)
 Sets the frames per second update rate.
unsigned frame_interval_ms ()
 Returns the frame interval in milliseconds that will be used when the viewer is running.
void set_frame_interval_ms (unsigned interval)
 Sets the frame interval in milliseconds that will be used when the viewer is running.
int run_priority ()
 Returns the run priority that will be used when the viewer is running.
void set_run_priority (int priority)
 Sets the run priority that will be used when the viewer is running.
double running_frame_step_rate ()
 Returns the frame step rate that will be used when the viewer is running.
void set_running_frame_step_rate (double frame_rate)
 Sets the frame step rate that will be used when the viewer is running.
int get_run_to_frame_number ()
 Returns the frame number that the viewer will run to.

Protected Member Functions

virtual bool on_run_step ()
void connect_timer ()
virtual int run_implementation ()

Static Protected Member Functions

static gboolean on_graphics_window_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer data)

Protected Attributes

bool m_is_running
unsigned m_frame_interval
int m_run_priority
double m_frame_step_rate
int m_run_to_frame_number
guint m_timeout_source_id

Static Private Member Functions

static gboolean on_run_step_proxy (gpointer data)
 Proxy callback point that passes the callback to the virtual on_run_step().


Detailed Description

Extends Viewer with several Gtk specific aspects.

In particular, the ability to establish this viewer in a gtk graphics window with the convenience method setup_viewer_in_gtk_window().

Also reimplements run() to use the glib timer main loop

Author:
Rick L Vinyard Jr <rvinyard@cs.nmsu.edu>

Constructor & Destructor Documentation

osgViewer::ViewerGtk::ViewerGtk (  ) 

osgViewer::ViewerGtk::ViewerGtk ( osg::ArgumentParser &  arguments  ) 

osgViewer::ViewerGtk::ViewerGtk ( const osgViewer::Viewer &  viewer,
const osg::CopyOp &  copyop = osg::CopyOp::SHALLOW_COPY 
)

osgViewer::ViewerGtk::~ViewerGtk (  )  [virtual]

If running, stops the viewer.

References is_running(), and stop().


Member Function Documentation

const char * osgViewer::ViewerGtk::className (  )  const [virtual]

void osgViewer::ViewerGtk::connect_timer (  )  [protected]

double osgViewer::ViewerGtk::fps (  ) 

Returns the frames-per-second rate based on the currently set frame interval.

References m_frame_interval.

unsigned osgViewer::ViewerGtk::frame_interval_ms (  ) 

Returns the frame interval in milliseconds that will be used when the viewer is running.

References m_frame_interval.

int osgViewer::ViewerGtk::get_run_to_frame_number (  ) 

Returns the frame number that the viewer will run to.

References m_run_to_frame_number.

bool osgViewer::ViewerGtk::is_running (  ) 

True if the viewer is running, false otherwise.

References m_is_running.

Referenced by set_fps(), set_frame_interval_ms(), set_run_priority(), and ~ViewerGtk().

bool osgViewer::ViewerGtk::isSameKindAs ( const osg::Object *  object  )  const [virtual]

const char * osgViewer::ViewerGtk::libraryName (  )  const [virtual]

gboolean osgViewer::ViewerGtk::on_graphics_window_expose_event ( GtkWidget *  widget,
GdkEventExpose *  event,
gpointer  data 
) [static, protected]

bool osgViewer::ViewerGtk::on_run_step (  )  [protected, virtual]

gboolean osgViewer::ViewerGtk::on_run_step_proxy ( gpointer  data  )  [static, private]

Proxy callback point that passes the callback to the virtual on_run_step().

References on_run_step().

Referenced by connect_timer().

int osgViewer::ViewerGtk::run (  )  [virtual]

Starts the viewer running at the currently set frame interval and priority.

Runs until stopped

References m_run_to_frame_number, and run_implementation().

int osgViewer::ViewerGtk::run_frames ( int  frames  ) 

Runs the viewer until the viewer's OSG frame stamp reaches the current frame stamp + frames.

References m_run_to_frame_number, and run_implementation().

int osgViewer::ViewerGtk::run_implementation (  )  [protected, virtual]

int osgViewer::ViewerGtk::run_priority (  ) 

Returns the run priority that will be used when the viewer is running.

References m_run_priority.

int osgViewer::ViewerGtk::run_to_frame ( int  frame_num  ) 

Runs the viewer until the viewer's OSG frame stamp reaches frame_num.

References m_run_to_frame_number, and run_implementation().

double osgViewer::ViewerGtk::running_frame_step_rate (  ) 

Returns the frame step rate that will be used when the viewer is running.

This is the value that will be passed to osgViewer::Viewer::advance() and controls the rate at which the viewer is advanced.

References m_frame_step_rate.

void osgViewer::ViewerGtk::set_fps ( double  fps  ) 

Sets the frames per second update rate.

Since the update interval has a resolution of 1ms, the update interval may not be exactly the same as the set rate.

For example, if set_fps(60) is called the actual update rate will not be 16.66667 ms (1000 ms / 60). Instead, the update rate will be the floor of 1000/60 or 16ms. Thus, the actual frame rate will be 62.5 fps.

References connect_timer(), is_running(), and m_frame_interval.

void osgViewer::ViewerGtk::set_frame_interval_ms ( unsigned  interval  ) 

Sets the frame interval in milliseconds that will be used when the viewer is running.

References connect_timer(), is_running(), and m_frame_interval.

void osgViewer::ViewerGtk::set_run_priority ( int  priority  ) 

Sets the run priority that will be used when the viewer is running.

References connect_timer(), is_running(), and m_run_priority.

void osgViewer::ViewerGtk::set_running_frame_step_rate ( double  frame_rate  ) 

Sets the frame step rate that will be used when the viewer is running.

References m_frame_step_rate.

GraphicsWindowGtk * osgViewer::ViewerGtk::setup_viewer_in_gtk_window ( int  width,
int  height 
)

Sets up this viewer to run in a Gtk window of the specified width and height.

References osgViewer::GraphicsWindowGtk::gtk_widget(), and on_graphics_window_expose_event().

void osgViewer::ViewerGtk::stop (  )  [virtual]

Stops the viewer from running.

References m_is_running, and m_timeout_source_id.

Referenced by on_run_step(), and ~ViewerGtk().


Member Data Documentation


The documentation for this class was generated from the following files:

Generated on Thu Mar 19 10:06:43 2009 for osgGtk by doxygen 1.5.7.1