From 77fef0c9e5be26f246484ed173f4c14203e6dade Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 31 Oct 2000 07:00:44 +0000 Subject: [PATCH] *** empty log message *** --- panda/src/display/graphicsPipe.cxx | 18 +++++ panda/src/display/graphicsPipe.h | 5 ++ panda/src/glxdisplay/Sources.pp | 4 +- panda/src/glxdisplay/config_glxdisplay.cxx | 2 + panda/src/glxdisplay/glxDisplay.I | 57 +++++++++++++++ panda/src/glxdisplay/glxDisplay.cxx | 62 ++++++++++++++++ panda/src/glxdisplay/glxDisplay.h | 65 +++++++++++++++++ panda/src/glxdisplay/glxGraphicsPipe.cxx | 71 +++++-------------- panda/src/glxdisplay/glxGraphicsPipe.h | 29 ++------ panda/src/glxdisplay/glxGraphicsWindow.cxx | 61 ++++++++-------- .../src/sgiglxdisplay/sgiglxGraphicsPipe.cxx | 20 +++++- panda/src/sgiglxdisplay/sgiglxGraphicsPipe.h | 6 +- 12 files changed, 286 insertions(+), 114 deletions(-) create mode 100644 panda/src/glxdisplay/glxDisplay.I create mode 100644 panda/src/glxdisplay/glxDisplay.cxx create mode 100644 panda/src/glxdisplay/glxDisplay.h diff --git a/panda/src/display/graphicsPipe.cxx b/panda/src/display/graphicsPipe.cxx index 1fa3bffdf0..d780f3f199 100644 --- a/panda/src/display/graphicsPipe.cxx +++ b/panda/src/display/graphicsPipe.cxx @@ -231,6 +231,24 @@ get_pipe(int n) { return get_all_pipes()[n]; } +//////////////////////////////////////////////////////////////////// +// Function: GraphicsPipe::get_glx_display +// Access: Public, Virtual +// Description: Returns the glxDisplay information associated with +// this pipe, if any. This allows us to define several +// kinds of GraphicsPipe objects that manage some +// glx-specific stuff, without having them all inherit +// from a common glx base class. This allows the +// glxGraphicsWindow to ask questions about the +// glx-specific stuff without knowing what kind of +// glxGraphicsPipe it has. Non-glx pipes will simply +// return NULL for this function. +//////////////////////////////////////////////////////////////////// +glxDisplay *GraphicsPipe:: +get_glx_display() { + return (glxDisplay *)NULL; +} + //////////////////////////////////////////////////////////////////// // Function: GraphicsPipe::get_num_hw_channels diff --git a/panda/src/display/graphicsPipe.h b/panda/src/display/graphicsPipe.h index 7c1bbd2897..9629192da0 100644 --- a/panda/src/display/graphicsPipe.h +++ b/panda/src/display/graphicsPipe.h @@ -27,6 +27,7 @@ // Defines //////////////////////////////////////////////////////////////////// class GraphicsPipe; +class glxDisplay; //////////////////////////////////////////////////////////////////// // Class : GraphicsPipe @@ -53,6 +54,10 @@ public: static int get_num_pipes(); static GraphicsPipe *get_pipe(int n); + // This function's interface must be defined here even though we + // know nothing about glx displays at this point. + virtual glxDisplay *get_glx_display(); + protected: virtual int get_num_hw_channels(); virtual HardwareChannel *get_hw_channel(GraphicsWindow *, int); diff --git a/panda/src/glxdisplay/Sources.pp b/panda/src/glxdisplay/Sources.pp index 8aa29a6504..1595f5500b 100644 --- a/panda/src/glxdisplay/Sources.pp +++ b/panda/src/glxdisplay/Sources.pp @@ -10,11 +10,13 @@ glgsg #define SOURCES \ - config_glxdisplay.cxx config_glxdisplay.h glxGraphicsPipe.cxx \ + config_glxdisplay.cxx config_glxdisplay.h \ + glxDisplay.I glxDisplay.h glxDisplay.cxx glxGraphicsPipe.cxx \ glxGraphicsPipe.h glxGraphicsWindow.I glxGraphicsWindow.cxx \ glxGraphicsWindow.h #define INSTALL_HEADERS \ + glxDisplay.I glxDisplay.h \ glxGraphicsPipe.h glxGraphicsWindow.I glxGraphicsWindow.h #end lib_target diff --git a/panda/src/glxdisplay/config_glxdisplay.cxx b/panda/src/glxdisplay/config_glxdisplay.cxx index 0105b75f3a..0d39404f2c 100644 --- a/panda/src/glxdisplay/config_glxdisplay.cxx +++ b/panda/src/glxdisplay/config_glxdisplay.cxx @@ -6,6 +6,7 @@ #include "config_glxdisplay.h" #include "glxGraphicsPipe.h" #include "glxGraphicsWindow.h" +#include "glxDisplay.h" #include @@ -19,4 +20,5 @@ ConfigureFn(config_glxdisplay) { glxGraphicsWindow::init_type(); GraphicsWindow::_factory.register_factory(glxGraphicsWindow::get_class_type(), glxGraphicsWindow::make_GlxGraphicsWindow); + glxDisplay::init_type(); } diff --git a/panda/src/glxdisplay/glxDisplay.I b/panda/src/glxdisplay/glxDisplay.I new file mode 100644 index 0000000000..a2db3c5db7 --- /dev/null +++ b/panda/src/glxdisplay/glxDisplay.I @@ -0,0 +1,57 @@ +// Filename: glxDisplay.I +// Created by: drose (30Oct00) +// +//////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////// +// Function: glxDisplay::get_display +// Access: Public +// Description: Returns a pointer to the X display associated with +// the pipe: the display on which to create the windows. +//////////////////////////////////////////////////////////////////// +INLINE Display *glxDisplay:: +get_display() const { + return _display; +} + +//////////////////////////////////////////////////////////////////// +// Function: glxDisplay::get_screen +// Access: Public +// Description: Returns the X screen number associated with the pipe. +//////////////////////////////////////////////////////////////////// +INLINE int glxDisplay:: +get_screen() const { + return _screen; +} + +//////////////////////////////////////////////////////////////////// +// Function: glxDisplay::get_root +// Access: Public +// Description: Returns the handle to the root window on the pipe's +// display. +//////////////////////////////////////////////////////////////////// +INLINE Window glxDisplay:: +get_root() const { + return _root; +} + +//////////////////////////////////////////////////////////////////// +// Function: glxDisplay::get_display_width +// Access: Public +// Description: Returns the width of the entire display. +//////////////////////////////////////////////////////////////////// +INLINE int glxDisplay:: +get_display_width() const { + return _width; +} + +//////////////////////////////////////////////////////////////////// +// Function: glxDisplay::get_display_height +// Access: Public +// Description: Returns the height of the entire display. +//////////////////////////////////////////////////////////////////// +INLINE int glxDisplay:: +get_display_height() const { + return _height; +} diff --git a/panda/src/glxdisplay/glxDisplay.cxx b/panda/src/glxdisplay/glxDisplay.cxx new file mode 100644 index 0000000000..323be51af4 --- /dev/null +++ b/panda/src/glxdisplay/glxDisplay.cxx @@ -0,0 +1,62 @@ +// Filename: glxDisplay.cxx +// Created by: drose (30Oct00) +// +//////////////////////////////////////////////////////////////////// + +#include "glxDisplay.h" +#include "glxGraphicsWindow.h" +#include "config_glxdisplay.h" + +#include + +#include + +TypeHandle glxDisplay::_type_handle; + +//////////////////////////////////////////////////////////////////// +// Function: glxDisplay::Constructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +glxDisplay:: +glxDisplay(GraphicsPipe *pipe, const string &x_specifier) { + _pipe = pipe; + _display = XOpenDisplay(x_specifier.c_str()); + if (!_display) { + glxdisplay_cat.fatal() + << "glxGraphicsPipe::construct(): Could not open display: " + << x_specifier << endl; + exit(1); + } + int errorBase, eventBase; + if (!glXQueryExtension(_display, &errorBase, &eventBase)) { + glxdisplay_cat.fatal() + << "glxGraphicsPipe::construct(): OpenGL GLX extension not " + << "supported by display: " << x_specifier << endl; + exit(1); + } + _screen = DefaultScreen(_display); + _root = RootWindow(_display, _screen); + _width = DisplayWidth(_display, _screen); + _height = DisplayHeight(_display, _screen); +} + + +//////////////////////////////////////////////////////////////////// +// Function: glxDisplay::find_window +// Access: Public +// Description: Find the window that has the xwindow "win" in the +// window list for the pipe (if it exists) +//////////////////////////////////////////////////////////////////// +glxGraphicsWindow *glxDisplay:: +find_window(Window win) const { + int num_windows = _pipe->get_num_windows(); + for (int w = 0; w < num_windows; w++) { + glxGraphicsWindow *window; + DCAST_INTO_R(window, _pipe->get_window(w), NULL); + if (window->get_xwindow() == win) { + return window; + } + } + return NULL; +} diff --git a/panda/src/glxdisplay/glxDisplay.h b/panda/src/glxdisplay/glxDisplay.h new file mode 100644 index 0000000000..6378bdde5e --- /dev/null +++ b/panda/src/glxdisplay/glxDisplay.h @@ -0,0 +1,65 @@ +// Filename: glxDisplay.h +// Created by: drose (30Oct00) +// +//////////////////////////////////////////////////////////////////// + +#ifndef GLXDISPLAY_H +#define GLXDISPLAY_H + +#include +#include + +#include + +class GraphicsPipe; +class glxGraphicsWindow; + +//////////////////////////////////////////////////////////////////// +// Class : glxDisplay +// Description : This class is a base class of glxGraphicsPipe, and +// also of SgiGlxGraphicsPipe and potentially other +// glx-based pipes. It simply records some information +// about the display that's useful to the +// glxGraphicsWindow. +//////////////////////////////////////////////////////////////////// +class glxDisplay : public TypedObject { +public: + glxDisplay(GraphicsPipe *pipe, const string &x_specifier); + + INLINE Display *get_display() const; + INLINE int get_screen() const; + INLINE Window get_root() const; + INLINE int get_display_width() const; + INLINE int get_display_height() const; + + glxGraphicsWindow *find_window(Window win) const; + +private: + GraphicsPipe *_pipe; + Display *_display; + int _screen; + Window _root; + int _width; + int _height; + +public: + static TypeHandle get_class_type() { + return _type_handle; + } + static void init_type() { + TypedObject::init_type(); + register_type(_type_handle, "glxDisplay", + TypedObject::get_class_type()); + } + virtual TypeHandle get_type() const { + return get_class_type(); + } + virtual TypeHandle force_init_type() {init_type(); return get_class_type();} + +private: + static TypeHandle _type_handle; +}; + +#include "glxDisplay.I" + +#endif diff --git a/panda/src/glxdisplay/glxGraphicsPipe.cxx b/panda/src/glxdisplay/glxGraphicsPipe.cxx index b0538d3d3b..b89d82b68a 100644 --- a/panda/src/glxdisplay/glxGraphicsPipe.cxx +++ b/panda/src/glxdisplay/glxGraphicsPipe.cxx @@ -17,27 +17,9 @@ TypeHandle glxGraphicsPipe::_type_handle; glxGraphicsPipe::glxGraphicsPipe(const PipeSpecifier& spec) - : InteractiveGraphicsPipe(spec) + : InteractiveGraphicsPipe(spec), + glxDisplay(this, spec.get_X_specifier()) { - // _display = XOpenDisplay(get_name().c_str()); - _display = XOpenDisplay((spec.get_X_specifier()).c_str()); - if (!_display) { - glxdisplay_cat.fatal() - << "glxGraphicsPipe::construct(): Could not open display: " - << spec.get_X_specifier() << endl; - exit(0); - } - int errorBase, eventBase; - if (!glXQueryExtension(_display, &errorBase, &eventBase)) { - glxdisplay_cat.fatal() - << "glxGraphicsPipe::construct(): OpenGL GLX extension not " - << "supported by display: " << spec.get_X_specifier() << endl; - exit(0); - } - _screen = DefaultScreen(_display); - _root = RootWindow(_display, _screen); - _width = DisplayWidth(_display, _screen); - _height = DisplayHeight(_display, _screen); } //////////////////////////////////////////////////////////////////// @@ -51,6 +33,17 @@ get_window_type() const { return glxGraphicsWindow::get_class_type(); } +//////////////////////////////////////////////////////////////////// +// Function: glxGraphicsPipe::get_glx_display +// Access: Public, Virtual +// Description: Returns the glxDisplay information associated with +// this pipe. +//////////////////////////////////////////////////////////////////// +glxDisplay *glxGraphicsPipe:: +get_glx_display() { + return this; +} + GraphicsPipe *glxGraphicsPipe:: make_glxGraphicsPipe(const FactoryParams ¶ms) { GraphicsPipe::PipeSpec *pipe_param; @@ -67,44 +60,12 @@ TypeHandle glxGraphicsPipe::get_class_type(void) { void glxGraphicsPipe::init_type(void) { InteractiveGraphicsPipe::init_type(); + glxDisplay::init_type(); register_type(_type_handle, "glxGraphicsPipe", - InteractiveGraphicsPipe::get_class_type()); + InteractiveGraphicsPipe::get_class_type(), + glxDisplay::get_class_type()); } TypeHandle glxGraphicsPipe::get_type(void) const { return get_class_type(); } - -glxGraphicsPipe::glxGraphicsPipe(void) { - glxdisplay_cat.error() - << "glxGraphicsPipes should not be created with the default constructor" - << endl; -} - -glxGraphicsPipe::glxGraphicsPipe(const glxGraphicsPipe&) { - glxdisplay_cat.error() - << "glxGraphicsPipes should not be copied" << endl; -} - -glxGraphicsPipe& glxGraphicsPipe::operator=(const glxGraphicsPipe&) { - glxdisplay_cat.error() - << "glxGraphicsPipes should not be assigned" << endl; - return *this; -} - -//////////////////////////////////////////////////////////////////// -// Function: find_window -// Access: -// Description: Find the window that has the xwindow "win" in the -// window list for the pipe (if it exists) -//////////////////////////////////////////////////////////////////// -glxGraphicsWindow *glxGraphicsPipe:: -find_window(Window win) { - int num_windows = get_num_windows(); - for (int w = 0; w < num_windows; w++) { - glxGraphicsWindow *window = DCAST(glxGraphicsWindow, get_window(w)); - if (window->get_xwindow() == win) - return window; - } - return NULL; -} diff --git a/panda/src/glxdisplay/glxGraphicsPipe.h b/panda/src/glxdisplay/glxGraphicsPipe.h index 062beadb1c..8830ea0a5c 100644 --- a/panda/src/glxdisplay/glxGraphicsPipe.h +++ b/panda/src/glxdisplay/glxGraphicsPipe.h @@ -11,21 +11,16 @@ //////////////////////////////////////////////////////////////////// #include -#include -#include #include "glxGraphicsWindow.h" -#include +#include "glxDisplay.h" -//////////////////////////////////////////////////////////////////// -// Defines -//////////////////////////////////////////////////////////////////// -class Xclass; +#include //////////////////////////////////////////////////////////////////// // Class : glxGraphicsPipe // Description : //////////////////////////////////////////////////////////////////// -class glxGraphicsPipe : public InteractiveGraphicsPipe +class glxGraphicsPipe : public InteractiveGraphicsPipe, public glxDisplay { public: @@ -33,7 +28,7 @@ class glxGraphicsPipe : public InteractiveGraphicsPipe virtual TypeHandle get_window_type() const; - glxGraphicsWindow* find_window(Window win); + virtual glxDisplay *get_glx_display(); public: @@ -44,25 +39,9 @@ class glxGraphicsPipe : public InteractiveGraphicsPipe virtual TypeHandle get_type(void) const; virtual TypeHandle force_init_type() {init_type(); return get_class_type();} - INLINE Display* get_display(void) { return _display; } - INLINE int get_screen(void) { return _screen; } - INLINE Window get_root(void) { return _root; } - private: static TypeHandle _type_handle; - - Display* _display; - int _screen; - Window _root; - int _width; - int _height; - - protected: - - glxGraphicsPipe( void ); - glxGraphicsPipe( const glxGraphicsPipe& ); - glxGraphicsPipe& operator=(const glxGraphicsPipe&); }; #endif diff --git a/panda/src/glxdisplay/glxGraphicsWindow.cxx b/panda/src/glxdisplay/glxGraphicsWindow.cxx index 24626246fb..85af138d6f 100644 --- a/panda/src/glxdisplay/glxGraphicsWindow.cxx +++ b/panda/src/glxdisplay/glxGraphicsWindow.cxx @@ -7,9 +7,10 @@ // Includes //////////////////////////////////////////////////////////////////// #include "glxGraphicsWindow.h" -#include "glxGraphicsPipe.h" +#include "glxDisplay.h" #include "config_glxdisplay.h" +#include #include #include #include @@ -82,11 +83,14 @@ bool glxGraphicsWindow::glx_supports(const char* extension) char* where, *terminator; int major, minor; + glxDisplay *glx = _pipe->get_glx_display(); + nassertr(glx != (glxDisplay *)NULL, false); + glXQueryVersion(_display, &major, &minor); if ((major == 1 && minor >= 1) || (major > 1)) { if (!_glx_extensions) { - _glx_extensions = glXQueryExtensionsString(_display, - ((glxGraphicsPipe *)_pipe)->get_screen()); + _glx_extensions = + glXQueryExtensionsString(_display, glx->get_screen()); } start = _glx_extensions; for (;;) { @@ -116,7 +120,7 @@ bool glxGraphicsWindow::glx_supports(const char* extension) // visual information if possible, or NULL if it is not. //////////////////////////////////////////////////////////////////// static XVisualInfo * -try_for_visual(glxGraphicsPipe *pipe, int mask, +try_for_visual(glxDisplay *glx, int mask, int want_depth_bits = 1, int want_color_bits = 1) { static const int max_attrib_list = 32; int attrib_list[max_attrib_list]; @@ -191,7 +195,7 @@ try_for_visual(glxGraphicsPipe *pipe, int mask, attrib_list[n] = (int)None; XVisualInfo *vinfo = - glXChooseVisual(pipe->get_display(), pipe->get_screen(), attrib_list); + glXChooseVisual(glx->get_display(), glx->get_screen(), attrib_list); if (glxdisplay_cat.is_debug()) { if (vinfo != NULL) { @@ -211,7 +215,8 @@ try_for_visual(glxGraphicsPipe *pipe, int mask, //////////////////////////////////////////////////////////////////// void glxGraphicsWindow::choose_visual(void) { - glxGraphicsPipe* pipe = DCAST(glxGraphicsPipe, _pipe); + glxDisplay *glx = _pipe->get_glx_display(); + nassertv(glx != (glxDisplay *)NULL); int mask = _props._mask; int want_depth_bits = _props._want_depth_bits; @@ -228,7 +233,7 @@ void glxGraphicsWindow::choose_visual(void) } #endif - _visual = try_for_visual(pipe, mask, want_depth_bits, want_color_bits); + _visual = try_for_visual(glx, mask, want_depth_bits, want_color_bits); // This is the severity level at which we'll report the details of // the visual we actually do find. Normally, it's debug-level @@ -258,7 +263,7 @@ void glxGraphicsWindow::choose_visual(void) // Actually, first we'll eliminate all of the minimum sizes, to // try to open a window with all of the requested options, but // maybe not as many bits in some options as we'd like. - _visual = try_for_visual(pipe, mask); + _visual = try_for_visual(glx, mask); } if (_visual == NULL) { @@ -304,7 +309,7 @@ void glxGraphicsWindow::choose_visual(void) for (i = 0; _visual == NULL && strip_properties[i] != 0; i++) { int new_mask = mask & ~strip_properties[i]; if (tried_masks.insert(new_mask).second) { - _visual = try_for_visual(pipe, new_mask, want_depth_bits, + _visual = try_for_visual(glx, new_mask, want_depth_bits, want_color_bits); } } @@ -319,7 +324,7 @@ void glxGraphicsWindow::choose_visual(void) for (i = 0; _visual == NULL && strip_properties[i] != 0; i++) { int new_mask = mask & ~strip_properties[i]; if (tried_masks.insert(new_mask).second) { - _visual = try_for_visual(pipe, new_mask); + _visual = try_for_visual(glx, new_mask); } } } @@ -328,7 +333,7 @@ void glxGraphicsWindow::choose_visual(void) if (_visual == NULL) { // Here's our last-ditch desparation attempt: give us any GLX // visual at all! - _visual = try_for_visual(pipe, 0); + _visual = try_for_visual(glx, 0); } if (_visual == NULL) { @@ -384,9 +389,10 @@ void glxGraphicsWindow::config( void ) { GraphicsWindow::config(); - // glxGraphicsPipe* pipe = (glxGraphicsPipe *)_pipe; - glxGraphicsPipe* pipe = DCAST(glxGraphicsPipe, _pipe); - _display = pipe->get_display(); + glxDisplay *glx = _pipe->get_glx_display(); + nassertv(glx != (glxDisplay *)NULL); + + _display = glx->get_display(); // Configure the framebuffer according to parameters specified in _props // Initializes _visual @@ -408,7 +414,7 @@ void glxGraphicsWindow::config( void ) wa.event_mask = _event_mask; wa.do_not_propagate_mask = 0; - _xwindow = XCreateWindow(_display, pipe->get_root(), + _xwindow = XCreateWindow(_display, glx->get_root(), _props._xorg, _props._yorg, _props._xsize, _props._ysize, 0, _visual->depth, InputOutput, _visual->visual, attrib_mask, &wa); if (!_xwindow) { @@ -481,9 +487,8 @@ void glxGraphicsWindow::setup_colormap(void) #else visual_class = _visual->class; #endif - - // glxGraphicsPipe* pipe = (glxGraphicsPipe *)_pipe; - glxGraphicsPipe* pipe = DCAST(glxGraphicsPipe, _pipe); + glxDisplay *glx = _pipe->get_glx_display(); + nassertv(glx != (glxDisplay *)NULL); switch (visual_class) { case PseudoColor: @@ -495,19 +500,19 @@ void glxGraphicsWindow::setup_colormap(void) // this is a terrible terrible hack, that seems to work _colormap = (Colormap)0; } else { - _colormap = XCreateColormap(_display, pipe->get_root(), + _colormap = XCreateColormap(_display, glx->get_root(), _visual->visual, AllocAll); } break; case TrueColor: case DirectColor: - _colormap = XCreateColormap(_display, pipe->get_root(), + _colormap = XCreateColormap(_display, glx->get_root(), _visual->visual, AllocNone); break; case StaticColor: case StaticGray: case GrayScale: - _colormap = XCreateColormap(_display, pipe->get_root(), + _colormap = XCreateColormap(_display, glx->get_root(), _visual->visual, AllocNone); break; default: @@ -1097,8 +1102,8 @@ void glxGraphicsWindow::process_events(void) int got_event; glxGraphicsWindow* window; - // glxGraphicsPipe* pipe = (glxGraphicsPipe *)_pipe; - glxGraphicsPipe* pipe = DCAST(glxGraphicsPipe, _pipe); + glxDisplay *glx = _pipe->get_glx_display(); + nassertv(glx != (glxDisplay *)NULL); do { got_event = interruptible_xnextevent(_display, &event); @@ -1108,7 +1113,7 @@ void glxGraphicsWindow::process_events(void) XRefreshKeyboardMapping((XMappingEvent *) &event); break; case ConfigureNotify: - if ((window = pipe->find_window(event.xconfigure.window)) != NULL) + if ((window = glx->find_window(event.xconfigure.window)) != NULL) window->process_event(event); break; case Expose: @@ -1124,16 +1129,16 @@ void glxGraphicsWindow::process_events(void) break; case ButtonPress: case ButtonRelease: - if ((window = pipe->find_window(event.xbutton.window)) != NULL) + if ((window = glx->find_window(event.xbutton.window)) != NULL) window->process_event(event); break; case MotionNotify: - if ((window = pipe->find_window(event.xmotion.window)) != NULL) + if ((window = glx->find_window(event.xmotion.window)) != NULL) window->process_event(event); break; case KeyPress: case KeyRelease: - if ((window = pipe->find_window(event.xmotion.window)) != NULL) + if ((window = glx->find_window(event.xmotion.window)) != NULL) window->process_event(event); break; case EnterNotify: @@ -1144,7 +1149,7 @@ void glxGraphicsWindow::process_events(void) // Ignore "virtual" window enter/leave events break; } - if ((window = pipe->find_window(event.xcrossing.window)) != NULL) + if ((window = glx->find_window(event.xcrossing.window)) != NULL) window->process_event(event); break; case UnmapNotify: diff --git a/panda/src/sgiglxdisplay/sgiglxGraphicsPipe.cxx b/panda/src/sgiglxdisplay/sgiglxGraphicsPipe.cxx index 2884e842f9..2f2cb81d50 100644 --- a/panda/src/sgiglxdisplay/sgiglxGraphicsPipe.cxx +++ b/panda/src/sgiglxdisplay/sgiglxGraphicsPipe.cxx @@ -12,7 +12,10 @@ TypeHandle SgiGlxGraphicsPipe::_type_handle; SgiGlxGraphicsPipe::SgiGlxGraphicsPipe(const PipeSpecifier& spec) - : sgiGraphicsPipe(spec) {} + : sgiGraphicsPipe(spec) + glxDisplay(this, spec.get_X_specifier()) +{ +} //////////////////////////////////////////////////////////////////// @@ -26,6 +29,17 @@ get_window_type() const { return glxGraphicsWindow::get_class_type(); } +//////////////////////////////////////////////////////////////////// +// Function: SgiGlxGraphicsPipe::get_glx_display +// Access: Public, Virtual +// Description: Returns the glxDisplay information associated with +// this pipe. +//////////////////////////////////////////////////////////////////// +SgiGlxDisplay *glxGraphicsPipe:: +get_glx_display() { + return this; +} + GraphicsPipe *SgiGlxGraphicsPipe:: make_sgiglxgraphicspipe(const FactoryParams ¶ms) { GraphicsPipe::PipeSpec *pipe_param; @@ -42,8 +56,10 @@ TypeHandle SgiGlxGraphicsPipe::get_class_type(void) { void SgiGlxGraphicsPipe::init_type(void) { sgiGraphicsPipe::init_type(); + glxDisplay::init_type(); register_type(_type_handle, "SgiGlxGraphicsPipe", - sgiGraphicsPipe::get_class_type()); + sgiGraphicsPipe::get_class_type(), + glxDisplay::get_class_type()); } TypeHandle SgiGlxGraphicsPipe::get_type(void) const { diff --git a/panda/src/sgiglxdisplay/sgiglxGraphicsPipe.h b/panda/src/sgiglxdisplay/sgiglxGraphicsPipe.h index 4abf295633..bd10b956b2 100644 --- a/panda/src/sgiglxdisplay/sgiglxGraphicsPipe.h +++ b/panda/src/sgiglxdisplay/sgiglxGraphicsPipe.h @@ -12,7 +12,7 @@ #include #include -#include +#include //////////////////////////////////////////////////////////////////// // Class : SgiGlxGraphicsPipe @@ -20,12 +20,12 @@ // supports the functionality of an sgi pipe with // hardware channels //////////////////////////////////////////////////////////////////// -class SgiGlxGraphicsPipe : public sgiGraphicsPipe -{ +class SgiGlxGraphicsPipe : public sgiGraphicsPipe, public glxDisplay { public: SgiGlxGraphicsPipe( const PipeSpecifier& ); virtual TypeHandle get_window_type() const; + virtual glxDisplay *get_glx_display(); static GraphicsPipe* make_sgiglxgraphicspipe(const FactoryParams ¶ms);