AGX Dynamics  2.37.3.2
agxOSG::EmbeddedGLWindow Class Reference

This class is for embedding an OSG based window inside another OpenGL contex, for example in QT. More...

#include <EmbeddedGLWindow.h>

Public Member Functions

 EmbeddedGLWindow ()
 Constructor. More...
 
 ~EmbeddedGLWindow ()
 Destructor. More...
 
void clear ()
 Will remove simulation, deallocate all scene graph elements After call to this method, init is required. More...
 
void fitSceneIntoView ()
 Will move the camera so that the whole scene is visible. More...
 
void frame ()
 Should be called to update the rendering frame. More...
 
osg::Camera * getCamera ()
 
const osg::Camera * getCamera () const
 
osgGA::EventQueue * getEventQueue () const
 
osg::Group * getRoot ()
 
const osg::Group * getRoot () const
 
agxOSG::SceneDecorator * getSceneDecorator ()
 
agxSDK::Simulation * getSimulation () const
 
bool init (int x, int y, int width, int height)
 Will initialize the scenegraph, camera, viewer A valid OpenGL context should be initialized and active for this to work. More...
 
void keyPressEvent (int key, int mod_mask)
 Called upon a keypress event. More...
 
void keyReleaseEvent (int key, int mod_mask)
 Called upon a keyrelease event. More...
 
void mouseMoveEvent (int x, int y)
 Called upon mouse event. More...
 
void mousePressEvent (int x, int y, int button)
 Called upon pressing a mouse button. More...
 
void mouseReleaseEvent (int x, int y, int button)
 Called upon releasing a mouse button. More...
 
void removeSimulation ()
 Deassociates any registered simulation. More...
 
void resize (int x, int y, int width, int height)
 Called at resize of the window. More...
 
void setSimulation (agxSDK::Simulation *simulation)
 Associate a Simulation to this window. More...
 
void wheelEvent (int motion)
 Called when the mouse wheel is used. More...
 

Detailed Description

This class is for embedding an OSG based window inside another OpenGL contex, for example in QT.

Definition at line 40 of file EmbeddedGLWindow.h.

Constructor & Destructor Documentation

◆ EmbeddedGLWindow()

agxOSG::EmbeddedGLWindow::EmbeddedGLWindow ( )

Constructor.

◆ ~EmbeddedGLWindow()

agxOSG::EmbeddedGLWindow::~EmbeddedGLWindow ( )

Destructor.

Member Function Documentation

◆ clear()

void agxOSG::EmbeddedGLWindow::clear ( )

Will remove simulation, deallocate all scene graph elements After call to this method, init is required.

◆ fitSceneIntoView()

void agxOSG::EmbeddedGLWindow::fitSceneIntoView ( )

Will move the camera so that the whole scene is visible.

◆ frame()

void agxOSG::EmbeddedGLWindow::frame ( )

Should be called to update the rendering frame.

◆ getCamera() [1/2]

osg::Camera* agxOSG::EmbeddedGLWindow::getCamera ( )
Returns
the camera

◆ getCamera() [2/2]

const osg::Camera* agxOSG::EmbeddedGLWindow::getCamera ( ) const
Returns
the camera

◆ getEventQueue()

osgGA::EventQueue* agxOSG::EmbeddedGLWindow::getEventQueue ( ) const

◆ getRoot() [1/2]

osg::Group* agxOSG::EmbeddedGLWindow::getRoot ( )
Returns
the root node

◆ getRoot() [2/2]

const osg::Group* agxOSG::EmbeddedGLWindow::getRoot ( ) const
Returns
the root node

◆ getSceneDecorator()

agxOSG::SceneDecorator* agxOSG::EmbeddedGLWindow::getSceneDecorator ( )
Returns
the SceneDecorator node

◆ getSimulation()

agxSDK::Simulation* agxOSG::EmbeddedGLWindow::getSimulation ( ) const
Returns
the associated simulation

◆ init()

bool agxOSG::EmbeddedGLWindow::init ( int  x,
int  y,
int  width,
int  height 
)

Will initialize the scenegraph, camera, viewer A valid OpenGL context should be initialized and active for this to work.

Parameters
x,y- Position of the window
width,height- Size of the window

◆ keyPressEvent()

void agxOSG::EmbeddedGLWindow::keyPressEvent ( int  key,
int  mod_mask 
)

Called upon a keypress event.

Parameters
key- which key is pressed
mod_mask- mask for the modification keys

◆ keyReleaseEvent()

void agxOSG::EmbeddedGLWindow::keyReleaseEvent ( int  key,
int  mod_mask 
)

Called upon a keyrelease event.

Parameters
key- which key is released
mod_mask- mask for the modification keys

◆ mouseMoveEvent()

void agxOSG::EmbeddedGLWindow::mouseMoveEvent ( int  x,
int  y 
)

Called upon mouse event.

Parameters
x,y- position of the mouse pointer in the window

◆ mousePressEvent()

void agxOSG::EmbeddedGLWindow::mousePressEvent ( int  x,
int  y,
int  button 
)

Called upon pressing a mouse button.

Parameters
x,y- position of the mouse pointer in the window
button- which button is pressed, 0,1,2

◆ mouseReleaseEvent()

void agxOSG::EmbeddedGLWindow::mouseReleaseEvent ( int  x,
int  y,
int  button 
)

Called upon releasing a mouse button.

Parameters
x,y- position of the mouse pointer in the window
button- which button is released, 0,1,2

◆ removeSimulation()

void agxOSG::EmbeddedGLWindow::removeSimulation ( )

Deassociates any registered simulation.

◆ resize()

void agxOSG::EmbeddedGLWindow::resize ( int  x,
int  y,
int  width,
int  height 
)

Called at resize of the window.

Parameters
x,y- new position of the window
width,height- new size of the window

◆ setSimulation()

void agxOSG::EmbeddedGLWindow::setSimulation ( agxSDK::Simulation *  simulation)

Associate a Simulation to this window.

Will be used to perform debug rendering. However, the simulation will not be step forward. That has to be handled explicitly

◆ wheelEvent()

void agxOSG::EmbeddedGLWindow::wheelEvent ( int  motion)

Called when the mouse wheel is used.

Parameters
motion- which direction the mouse wheel is moved, 0,1 (up/down)

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