Updated the osgGLUT::Viewer to subclass from osgGLUT::Window as has been

intended since the development of osgGLUT::Window.
This commit is contained in:
Robert Osfield
2001-12-24 19:06:49 +00:00
parent 4221132626
commit a6d329b812
6 changed files with 65 additions and 198 deletions

View File

@@ -15,15 +15,12 @@
#include <osgUtil/CameraManipulator>
#include <osgUtil/SceneView>
#include <osgGLUT/Export>
#ifdef SGV_USE_RTFS
#include <rtfs/rtfs.h>
#endif
#include <osgGLUT/Window>
#include <string>
namespace osgGLUT{
namespace osgGLUT
{
/** A basic viewer base class which provides a window, simple keyboard and mouse interaction.
* Please note, this viewer class has been developed via a rather haphazard
@@ -31,17 +28,13 @@ namespace osgGLUT{
* but shouldn't be viewed as the be all and end of osg viewer classes.
* Someone please rewrite it :-)
*/
class OSGGLUT_EXPORT Viewer : public osgUtil::GUIActionAdapter
class OSGGLUT_EXPORT Viewer : public Window, osgUtil::GUIActionAdapter
{
public:
Viewer();
virtual ~Viewer();
void setWindowOrigin(int x, int y) { wx = x, wy = y; };
void setWindowSize(int width, int height) { ww = width, wh = height; };
void setWindowTitle(const std::string& title) { _title = title; }
/** init is deprecated, you should use addViewport instead. init is
* only available for backwards compatibility.*/
virtual void init(osg::Node* rootnode);
@@ -97,17 +90,8 @@ class OSGGLUT_EXPORT Viewer : public osgUtil::GUIActionAdapter
protected:
static void displayCB();
static void reshapeCB(int w, int h);
static void visibilityCB(int state);
static void mouseMotionCB(int x, int y);
static void mousePassiveMotionCB(int x, int y);
static void mouseCB(int button, int state, int x, int y);
static void keyboardCB(unsigned char key, int x, int y );
virtual void display();
virtual void reshape(GLint w, GLint h);
virtual void visibility(int state);
virtual void mouseMotion(int x, int y);
virtual void mousePassiveMotion(int x, int y);
virtual void mouse(int button, int state, int x, int y);
@@ -136,15 +120,6 @@ class OSGGLUT_EXPORT Viewer : public osgUtil::GUIActionAdapter
unsigned int _focusedViewport;
std::string _saveFileName;
std::string _title;
int wx, wy, ww, wh;
int _is_open;
#ifdef SGV_USE_RTFS
unsigned int frame_rate;
RTfs *fs;
#endif
bool _viewFrustumCullingActive;
bool _smallFeatureCullingActive;

View File

@@ -9,15 +9,16 @@
#include <string>
namespace osgGLUT{
namespace osgGLUT
{
/** A basic GLUTWindow base class which provides a just a basic window. */
class OSGGLUT_EXPORT GLUTWindow
class OSGGLUT_EXPORT Window
{
public:
GLUTWindow();
virtual ~GLUTWindow();
Window();
virtual ~Window();
void setWindowOrigin(int x, int y) { _wx = x, _wy = y; };
void setWindowSize(int width, int height) { _ww = width, _wh = height; };
@@ -27,7 +28,7 @@ class OSGGLUT_EXPORT GLUTWindow
virtual bool open();
virtual bool run();
virtual void display();
protected:
static void displayCB();
@@ -45,7 +46,7 @@ class OSGGLUT_EXPORT GLUTWindow
virtual void mouse(int button, int state, int x, int y);
virtual void keyboard(unsigned char key, int x, int y);
static GLUTWindow* s_theGLUTWindow;
static Window* s_theWindow;
std::string _title;
int _wx, _wy, _ww, _wh;