diff --git a/panda/src/display/config_display.cxx b/panda/src/display/config_display.cxx index c6bbd49dea..57a3147bb6 100644 --- a/panda/src/display/config_display.cxx +++ b/panda/src/display/config_display.cxx @@ -72,7 +72,15 @@ const bool multiple_windows = config_display.GetBool("multiple-windows", false); // more polite to other applications that are trying to run. const bool yield_timeslice = config_display.GetBool("yield-timeslice", false); -// Use the variable load-display to specifiy the name of the default +const string screenshot_filename = config_display.GetString("screenshot-filename", "%~p-%a-%b-%d-%H-%M-%S-%Y-%~f.%~e"); +const string screenshot_extension = config_display.GetString("screenshot-extension", "jpg"); + +// Set this true to cause offscreen GraphicsBuffers to be created as +// GraphicsWindows, if possible, so that their contents may be viewed +// interactively. Handy during development of multipass algorithms. +const bool show_buffers = config_display.GetBool("show-buffers", false); + +// Use the variable load-display to specify the name of the default // graphics display library or GraphicsPipe to load. It is the name // of a shared library (or * for all libraries named in aux-display), // optionally followed by the name of the particular GraphicsPipe @@ -83,9 +91,6 @@ const bool yield_timeslice = config_display.GetBool("yield-timeslice", false); // This variable may be repeated several times. -const string screenshot_filename = config_display.GetString("screenshot-filename", "%~p-%a-%b-%d-%H-%M-%S-%Y-%~f.%~e"); -const string screenshot_extension = config_display.GetString("screenshot-extension", "jpg"); - //////////////////////////////////////////////////////////////////// // Function: init_libdisplay // Description: Initializes the library. This must be called at diff --git a/panda/src/display/config_display.h b/panda/src/display/config_display.h index 88394167cf..e46156a210 100644 --- a/panda/src/display/config_display.h +++ b/panda/src/display/config_display.h @@ -40,6 +40,8 @@ extern const bool yield_timeslice; extern const string screenshot_filename; extern const string screenshot_extension; +extern const bool show_buffers; + extern EXPCL_PANDA const bool multiple_windows; extern EXPCL_PANDA void init_libdisplay(); diff --git a/panda/src/display/graphicsBuffer.I b/panda/src/display/graphicsBuffer.I index ea3243790c..4138642aca 100644 --- a/panda/src/display/graphicsBuffer.I +++ b/panda/src/display/graphicsBuffer.I @@ -16,35 +16,3 @@ // //////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////// -// Function: GraphicsBuffer::has_texture -// Access: Published -// Description: Returns true if the GraphicsBuffer is set to render -// into a texture (because want_texture has been passed -// to the GraphicsBuffer constructor), or false -// otherwise. -//////////////////////////////////////////////////////////////////// -INLINE bool GraphicsBuffer:: -has_texture() const { - return !(_texture.is_null()); -} - -//////////////////////////////////////////////////////////////////// -// Function: GraphicsBuffer::get_texture -// Access: Published -// Description: Returns the texture into which the GraphicsBuffer -// renders, if any, or NULL if want_texture was passed -// into the constructor as false. -// -// If the texture is non-NULL, it may be applied to -// geometry to be rendered for any other windows or -// buffers that share the same GSG as this -// GraphicsBuffer. The effect is undefined for windows -// that share a different GSG; usually in these cases -// the texture will be invalid. -//////////////////////////////////////////////////////////////////// -INLINE Texture *GraphicsBuffer:: -get_texture() const { - return _texture; -} diff --git a/panda/src/display/graphicsBuffer.cxx b/panda/src/display/graphicsBuffer.cxx index b58b4f7e0b..22c5e0b2a9 100644 --- a/panda/src/display/graphicsBuffer.cxx +++ b/panda/src/display/graphicsBuffer.cxx @@ -29,8 +29,8 @@ TypeHandle GraphicsBuffer::_type_handle; //////////////////////////////////////////////////////////////////// GraphicsBuffer:: GraphicsBuffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, - int x_size, int y_size, bool want_texture) : - GraphicsOutput(pipe, gsg) + const string &name, int x_size, int y_size, bool want_texture) : + GraphicsOutput(pipe, gsg, name) { #ifdef DO_MEMORY_USAGE MemoryUsage::update_type(this, this); @@ -43,6 +43,8 @@ GraphicsBuffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, if (want_texture) { _texture = new Texture(); + _texture->set_name(_name); + _copy_texture = true; } _x_size = x_size; diff --git a/panda/src/display/graphicsBuffer.h b/panda/src/display/graphicsBuffer.h index e164132be7..cf84232ae6 100644 --- a/panda/src/display/graphicsBuffer.h +++ b/panda/src/display/graphicsBuffer.h @@ -41,14 +41,12 @@ class EXPCL_PANDA GraphicsBuffer : public GraphicsOutput { protected: GraphicsBuffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + const string &name, int x_size, int y_size, bool want_texture); PUBLISHED: virtual ~GraphicsBuffer(); - INLINE bool has_texture() const; - INLINE Texture *get_texture() const; - public: virtual void request_open(); virtual void request_close(); @@ -64,8 +62,6 @@ protected: virtual bool open_buffer(); protected: - PT(Texture) _texture; - enum OpenRequest { OR_none, OR_open, diff --git a/panda/src/display/graphicsEngine.I b/panda/src/display/graphicsEngine.I index b16a5e811c..1f80360ce9 100644 --- a/panda/src/display/graphicsEngine.I +++ b/panda/src/display/graphicsEngine.I @@ -80,36 +80,6 @@ make_gsg(GraphicsPipe *pipe) { } -//////////////////////////////////////////////////////////////////// -// Function: GraphicsEngine::make_window -// Access: Published -// Description: Creates a new window using the indicated -// GraphicsStateGuardian and returns it. The -// GraphicsEngine becomes the owner of the window; it -// will persist at least until remove_window() is called -// later. -//////////////////////////////////////////////////////////////////// -INLINE GraphicsWindow *GraphicsEngine:: -make_window(GraphicsPipe *pipe, GraphicsStateGuardian *gsg) { - return make_window(pipe, gsg, get_threading_model()); -} - -//////////////////////////////////////////////////////////////////// -// Function: GraphicsEngine::make_buffer -// Access: Published -// Description: Creates a new offscreen buffer using the indicated -// GraphicsStateGuardian and returns it. The -// GraphicsEngine becomes the owner of the buffer; it -// will persist at least until remove_buffer() is called -// later. -//////////////////////////////////////////////////////////////////// -INLINE GraphicsBuffer *GraphicsEngine:: -make_buffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, - int x_size, int y_size, bool want_texture) { - return make_buffer(pipe, gsg, x_size, y_size, want_texture, - get_threading_model()); -} - //////////////////////////////////////////////////////////////////// // Function: GraphicsEngine::close_gsg // Access: Published diff --git a/panda/src/display/graphicsEngine.cxx b/panda/src/display/graphicsEngine.cxx index eec4e172d8..be132a6c24 100644 --- a/panda/src/display/graphicsEngine.cxx +++ b/panda/src/display/graphicsEngine.cxx @@ -205,16 +205,17 @@ make_gsg(GraphicsPipe *pipe, const FrameBufferProperties &properties, //////////////////////////////////////////////////////////////////// GraphicsWindow *GraphicsEngine:: make_window(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, - const GraphicsThreadingModel &threading_model) { - if (gsg != (GraphicsStateGuardian *)NULL) { - nassertr(pipe == gsg->get_pipe(), NULL); - nassertr(this == gsg->get_engine(), NULL); - nassertr(threading_model.get_draw_name() == - gsg->get_threading_model().get_draw_name(), NULL); - } + const string &name) { + GraphicsThreadingModel threading_model = get_threading_model(); + + nassertr(gsg != (GraphicsStateGuardian *)NULL, NULL); + nassertr(pipe == gsg->get_pipe(), NULL); + nassertr(this == gsg->get_engine(), NULL); + nassertr(threading_model.get_draw_name() == + gsg->get_threading_model().get_draw_name(), NULL); // TODO: ask the window thread to make the window. - PT(GraphicsWindow) window = pipe->make_window(gsg); + PT(GraphicsWindow) window = pipe->make_window(gsg, name); do_add_window(window, gsg, threading_model); return window; } @@ -227,21 +228,43 @@ make_window(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, // GraphicsEngine becomes the owner of the buffer; it // will persist at least until remove_window() is called // later. + +// This usually returns a GraphicsBuffer object, but it +// may actually return a GraphicsWindow if show-buffers +// is configured true. //////////////////////////////////////////////////////////////////// -GraphicsBuffer *GraphicsEngine:: +GraphicsOutput *GraphicsEngine:: make_buffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, - int x_size, int y_size, bool want_texture, - const GraphicsThreadingModel &threading_model) { - if (gsg != (GraphicsStateGuardian *)NULL) { - nassertr(pipe == gsg->get_pipe(), NULL); - nassertr(this == gsg->get_engine(), NULL); - nassertr(threading_model.get_draw_name() == - gsg->get_threading_model().get_draw_name(), NULL); + const string &name, int x_size, int y_size, bool want_texture) { + if (show_buffers) { + GraphicsWindow *window = make_window(pipe, gsg, name); + if (window != (GraphicsWindow *)NULL) { + WindowProperties props; + props.set_size(x_size, y_size); + props.set_fixed_size(true); + props.set_title(name); + window->request_properties(props); + + if (want_texture) { + window->_texture = new Texture(); + window->_texture->set_name(name); + window->_copy_texture = true; + } + + return window; + } } + GraphicsThreadingModel threading_model = get_threading_model(); + nassertr(gsg != (GraphicsStateGuardian *)NULL, NULL); + nassertr(pipe == gsg->get_pipe(), NULL); + nassertr(this == gsg->get_engine(), NULL); + nassertr(threading_model.get_draw_name() == + gsg->get_threading_model().get_draw_name(), NULL); + // TODO: ask the window thread to make the buffer. PT(GraphicsBuffer) buffer = - pipe->make_buffer(gsg, x_size, y_size, want_texture); + pipe->make_buffer(gsg, name, x_size, y_size, want_texture); do_add_window(buffer, gsg, threading_model); return buffer; } @@ -553,7 +576,7 @@ cull_bin_draw(const GraphicsEngine::Windows &wlist) { Windows::const_iterator wi; for (wi = wlist.begin(); wi != wlist.end(); ++wi) { GraphicsOutput *win = (*wi); - if (win->is_active()) { + if (win->is_active() && win->get_gsg()->is_active()) { // This should be done in the draw thread, not here. if (win->begin_frame()) { win->clear(); diff --git a/panda/src/display/graphicsEngine.h b/panda/src/display/graphicsEngine.h index b6b7b9c0d5..1066410695 100644 --- a/panda/src/display/graphicsEngine.h +++ b/panda/src/display/graphicsEngine.h @@ -72,18 +72,11 @@ PUBLISHED: const FrameBufferProperties &properties, const GraphicsThreadingModel &threading_model); - INLINE GraphicsWindow *make_window(GraphicsPipe *pipe, - GraphicsStateGuardian *gsg); - GraphicsWindow *make_window(GraphicsPipe *pipe, - GraphicsStateGuardian *gsg, - const GraphicsThreadingModel &threading_model); - INLINE GraphicsBuffer *make_buffer(GraphicsPipe *pipe, - GraphicsStateGuardian *gsg, - int x_size, int y_size, bool want_texture); - GraphicsBuffer *make_buffer(GraphicsPipe *pipe, - GraphicsStateGuardian *gsg, - int x_size, int y_size, bool want_texture, - const GraphicsThreadingModel &threading_model); + GraphicsWindow *make_window(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + const string &name); + GraphicsOutput *make_buffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + const string &name, + int x_size, int y_size, bool want_texture); bool remove_window(GraphicsOutput *window); void remove_all_windows(); diff --git a/panda/src/display/graphicsOutput.I b/panda/src/display/graphicsOutput.I index dec15e08a5..2bb72c9d66 100644 --- a/panda/src/display/graphicsOutput.I +++ b/panda/src/display/graphicsOutput.I @@ -49,6 +49,54 @@ get_pipe() const { return _pipe; } +//////////////////////////////////////////////////////////////////// +// Function: GraphicsOutput::get_name +// Access: Published +// Description: Returns the name that was passed to the +// GraphicsOutput constructor. +//////////////////////////////////////////////////////////////////// +INLINE const string &GraphicsOutput:: +get_name() const { + return _name; +} + +//////////////////////////////////////////////////////////////////// +// Function: GraphicsOutput::has_texture +// Access: Published +// Description: Returns true if the GraphicsOutput is set to render +// into a texture, or false otherwise. +// +// Normally, this will only be true for a GraphicsBuffer +// object, and only when want_texture is passed in as +// true to the GraphicsBuffer constructor. If +// show-buffers is true, this may also be set for a +// GraphicsWindow, which is in this case serving in the +// place of a GraphicsBuffer. +//////////////////////////////////////////////////////////////////// +INLINE bool GraphicsOutput:: +has_texture() const { + return !(_texture.is_null()); +} + +//////////////////////////////////////////////////////////////////// +// Function: GraphicsOutput::get_texture +// Access: Published +// Description: Returns the texture into which the GraphicsOutput +// renders, if has_texture() is true, or NULL if +// has_texture() is false. +// +// If the texture is non-NULL, it may be applied to +// geometry to be rendered for any other windows or +// outputs that share the same GSG as this +// GraphicsOutput. The effect is undefined for windows +// that share a different GSG; usually in these cases +// the texture will be invalid. +//////////////////////////////////////////////////////////////////// +INLINE Texture *GraphicsOutput:: +get_texture() const { + return _texture; +} + //////////////////////////////////////////////////////////////////// // Function: GraphicsOutput::get_x_size // Access: Published diff --git a/panda/src/display/graphicsOutput.cxx b/panda/src/display/graphicsOutput.cxx index 4633f38e5a..1a9fe3eb64 100644 --- a/panda/src/display/graphicsOutput.cxx +++ b/panda/src/display/graphicsOutput.cxx @@ -36,16 +36,19 @@ PStatCollector GraphicsOutput::_make_current_pcollector("Draw:Make current"); // GraphicsEngine::make_window() function. //////////////////////////////////////////////////////////////////// GraphicsOutput:: -GraphicsOutput(GraphicsPipe *pipe, GraphicsStateGuardian *gsg) { +GraphicsOutput(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + const string &name) { #ifdef DO_MEMORY_USAGE MemoryUsage::update_type(this, this); #endif _pipe = pipe; _gsg = gsg; + _name = name; _x_size = 0; _y_size = 0; _has_size = false; _is_valid = false; + _copy_texture = false; _display_regions_stale = false; @@ -533,6 +536,16 @@ void GraphicsOutput:: end_frame() { nassertv(_gsg != (GraphicsStateGuardian *)NULL); _gsg->end_frame(); + + // By default, we copy the framebuffer to the texture at the end of + // the frame. GraphicsBuffer objects that are set up to render + // directly into texture memory don't need to do this; they will set + // _copy_texture to false. + if (_copy_texture) { + nassertv(has_texture()); + DisplayRegion dr(_x_size, _y_size); + get_texture()->copy(_gsg, &dr, _gsg->get_render_buffer(RenderBuffer::T_back)); + } } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/display/graphicsOutput.h b/panda/src/display/graphicsOutput.h index 059cc00c68..48043c990a 100644 --- a/panda/src/display/graphicsOutput.h +++ b/panda/src/display/graphicsOutput.h @@ -43,10 +43,8 @@ class PNMImage; // classes that represent the result of a frame of // rendering. The most common kind of GraphicsOutput is // a GraphicsWindow, which is a real-time window on the -// desktop, but other examples are GraphicsBuffer, which -// is an offscreen buffer, and GraphicsTexture, which is -// an offscreen texture that may be rendered into and -// then applied to geometry. +// desktop, but another example is GraphicsBuffer, which +// is an offscreen buffer. // // The actual rendering, and anything associated with // the graphics context itself, is managed by the @@ -61,7 +59,8 @@ class PNMImage; //////////////////////////////////////////////////////////////////// class EXPCL_PANDA GraphicsOutput : public TypedWritableReferenceCount, public ClearableRegion { protected: - GraphicsOutput(GraphicsPipe *pipe, GraphicsStateGuardian *gsg); + GraphicsOutput(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + const string &name); private: GraphicsOutput(const GraphicsOutput ©); @@ -72,6 +71,10 @@ PUBLISHED: INLINE GraphicsStateGuardian *get_gsg() const; INLINE GraphicsPipe *get_pipe() const; + INLINE const string &get_name() const; + + INLINE bool has_texture() const; + INLINE Texture *get_texture() const; INLINE int get_x_size() const; INLINE int get_y_size() const; @@ -135,6 +138,9 @@ protected: protected: PT(GraphicsStateGuardian) _gsg; PT(GraphicsPipe) _pipe; + string _name; + PT(Texture) _texture; + bool _copy_texture; private: INLINE void determine_display_regions() const; diff --git a/panda/src/display/graphicsPipe.cxx b/panda/src/display/graphicsPipe.cxx index 75240f7b7b..9d5191e24f 100644 --- a/panda/src/display/graphicsPipe.cxx +++ b/panda/src/display/graphicsPipe.cxx @@ -154,7 +154,7 @@ close_gsg(GraphicsStateGuardian *gsg) { // Description: Creates a new window on the pipe, if possible. //////////////////////////////////////////////////////////////////// PT(GraphicsWindow) GraphicsPipe:: -make_window(GraphicsStateGuardian *) { +make_window(GraphicsStateGuardian *, const string &) { display_cat.error() << get_type() << " cannot create onscreen windows.\n"; return NULL; @@ -166,7 +166,7 @@ make_window(GraphicsStateGuardian *) { // Description: Creates a new offscreen buffer on the pipe, if possible. //////////////////////////////////////////////////////////////////// PT(GraphicsBuffer) GraphicsPipe:: -make_buffer(GraphicsStateGuardian *, int, int, bool) { +make_buffer(GraphicsStateGuardian *, const string &, int, int, bool) { display_cat.error() << get_type() << " cannot create offscreen buffers.\n"; return NULL; diff --git a/panda/src/display/graphicsPipe.h b/panda/src/display/graphicsPipe.h index ce99abfb00..53d80469ed 100644 --- a/panda/src/display/graphicsPipe.h +++ b/panda/src/display/graphicsPipe.h @@ -95,8 +95,10 @@ protected: // the interface on GraphicsEngine to make a new window or gsg. virtual PT(GraphicsStateGuardian) make_gsg(const FrameBufferProperties &properties); virtual void close_gsg(GraphicsStateGuardian *gsg); - virtual PT(GraphicsWindow) make_window(GraphicsStateGuardian *gsg); + virtual PT(GraphicsWindow) make_window(GraphicsStateGuardian *gsg, + const string &name); virtual PT(GraphicsBuffer) make_buffer(GraphicsStateGuardian *gsg, + const string &name, int x_size, int y_size, bool want_texture); Mutex _lock; diff --git a/panda/src/display/graphicsStateGuardian.I b/panda/src/display/graphicsStateGuardian.I index 583d4a9b39..36c919b827 100644 --- a/panda/src/display/graphicsStateGuardian.I +++ b/panda/src/display/graphicsStateGuardian.I @@ -40,51 +40,6 @@ ClipPlaneInfo() { } -//////////////////////////////////////////////////////////////////// -// Function: GraphicsStateGuardian::get_properties -// Access: Public -// Description: Returns the frame buffer properties requested for -// this GSG. All windows created for this GSG must be -// created with the same properties. -//////////////////////////////////////////////////////////////////// -INLINE const FrameBufferProperties &GraphicsStateGuardian:: -get_properties() const { - return _properties; -} - -//////////////////////////////////////////////////////////////////// -// Function: GraphicsStateGuardian::get_pipe -// Access: Public -// Description: Returns the graphics pipe on which this GSG was -// created. -//////////////////////////////////////////////////////////////////// -INLINE GraphicsPipe *GraphicsStateGuardian:: -get_pipe() const { - return _pipe; -} - -//////////////////////////////////////////////////////////////////// -// Function: GraphicsStateGuardian::get_engine -// Access: Public -// Description: Returns the graphics engine that created this GSG. -//////////////////////////////////////////////////////////////////// -INLINE GraphicsEngine *GraphicsStateGuardian:: -get_engine() const { - return _engine; -} - -//////////////////////////////////////////////////////////////////// -// Function: GraphicsStateGuardian::get_threading_model -// Access: Public -// Description: Returns the threading model that was used to create -// this GSG. -//////////////////////////////////////////////////////////////////// -INLINE const GraphicsThreadingModel &GraphicsStateGuardian:: -get_threading_model() const { - return _threading_model; -} - - //////////////////////////////////////////////////////////////////// // Function: GraphicsStateGuardian::set_active // Access: Published @@ -110,6 +65,51 @@ is_active() const { return _active; } +//////////////////////////////////////////////////////////////////// +// Function: GraphicsStateGuardian::get_properties +// Access: Published +// Description: Returns the frame buffer properties requested for +// this GSG. All windows created for this GSG must be +// created with the same properties. +//////////////////////////////////////////////////////////////////// +INLINE const FrameBufferProperties &GraphicsStateGuardian:: +get_properties() const { + return _properties; +} + +//////////////////////////////////////////////////////////////////// +// Function: GraphicsStateGuardian::get_pipe +// Access: Published +// Description: Returns the graphics pipe on which this GSG was +// created. +//////////////////////////////////////////////////////////////////// +INLINE GraphicsPipe *GraphicsStateGuardian:: +get_pipe() const { + return _pipe; +} + +//////////////////////////////////////////////////////////////////// +// Function: GraphicsStateGuardian::get_engine +// Access: Published +// Description: Returns the graphics engine that created this GSG. +//////////////////////////////////////////////////////////////////// +INLINE GraphicsEngine *GraphicsStateGuardian:: +get_engine() const { + return _engine; +} + +//////////////////////////////////////////////////////////////////// +// Function: GraphicsStateGuardian::get_threading_model +// Access: Published +// Description: Returns the threading model that was used to create +// this GSG. +//////////////////////////////////////////////////////////////////// +INLINE const GraphicsThreadingModel &GraphicsStateGuardian:: +get_threading_model() const { + return _threading_model; +} + + //////////////////////////////////////////////////////////////////// // Function: GraphicsStateGuardian::set_scene // Access: Public diff --git a/panda/src/display/graphicsStateGuardian.h b/panda/src/display/graphicsStateGuardian.h index 3c04cc5d47..1d32c3fe1b 100644 --- a/panda/src/display/graphicsStateGuardian.h +++ b/panda/src/display/graphicsStateGuardian.h @@ -72,15 +72,15 @@ PUBLISHED: void release_all_textures(); void release_all_geoms(); -public: + INLINE void set_active(bool active); + INLINE bool is_active() const; + INLINE const FrameBufferProperties &get_properties() const; INLINE GraphicsPipe *get_pipe() const; INLINE GraphicsEngine *get_engine() const; INLINE const GraphicsThreadingModel &get_threading_model() const; - INLINE void set_active(bool active); - INLINE bool is_active() const; - +public: INLINE void set_scene(SceneSetup *scene_setup); INLINE SceneSetup *get_scene() const; diff --git a/panda/src/display/graphicsWindow.cxx b/panda/src/display/graphicsWindow.cxx index 65362d6966..a24cb62f0b 100644 --- a/panda/src/display/graphicsWindow.cxx +++ b/panda/src/display/graphicsWindow.cxx @@ -35,8 +35,9 @@ TypeHandle GraphicsWindow::_type_handle; // GraphicsEngine::make_window() function. //////////////////////////////////////////////////////////////////// GraphicsWindow:: -GraphicsWindow(GraphicsPipe *pipe, GraphicsStateGuardian *gsg) : - GraphicsOutput(pipe, gsg) +GraphicsWindow(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + const string &name) : + GraphicsOutput(pipe, gsg, name) { #ifdef DO_MEMORY_USAGE MemoryUsage::update_type(this, this); diff --git a/panda/src/display/graphicsWindow.h b/panda/src/display/graphicsWindow.h index 2e40706ea7..da3669a342 100644 --- a/panda/src/display/graphicsWindow.h +++ b/panda/src/display/graphicsWindow.h @@ -39,7 +39,8 @@ //////////////////////////////////////////////////////////////////// class EXPCL_PANDA GraphicsWindow : public GraphicsOutput { protected: - GraphicsWindow(GraphicsPipe *pipe, GraphicsStateGuardian *gsg); + GraphicsWindow(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + const string &name); PUBLISHED: virtual ~GraphicsWindow(); @@ -127,6 +128,8 @@ public: private: static TypeHandle _type_handle; + + friend class GraphicsEngine; }; #include "graphicsWindow.I" diff --git a/panda/src/display/windowProperties.I b/panda/src/display/windowProperties.I index c6f736b46d..b94aec2bfd 100644 --- a/panda/src/display/windowProperties.I +++ b/panda/src/display/windowProperties.I @@ -276,6 +276,54 @@ clear_undecorated() { _flags &= ~F_undecorated; } +//////////////////////////////////////////////////////////////////// +// Function: WindowProperties::set_fixed_size +// Access: Published +// Description: Specifies whether the window should be resizable by +// the user. +//////////////////////////////////////////////////////////////////// +INLINE void WindowProperties:: +set_fixed_size(bool fixed_size) { + if (fixed_size) { + _flags |= F_fixed_size; + } else { + _flags &= ~F_fixed_size; + } + _specified |= S_fixed_size; +} + +//////////////////////////////////////////////////////////////////// +// Function: WindowProperties::get_fixed_size +// Access: Published +// Description: Returns true if the window cannot be resized by the +// user, false otherwise. +//////////////////////////////////////////////////////////////////// +INLINE bool WindowProperties:: +get_fixed_size() const { + return (_flags & F_fixed_size) != 0; +} + +//////////////////////////////////////////////////////////////////// +// Function: WindowProperties::has_fixed_size +// Access: Published +// Description: Returns true if set_fixed_size() has been specified. +//////////////////////////////////////////////////////////////////// +INLINE bool WindowProperties:: +has_fixed_size() const { + return ((_specified & S_fixed_size) != 0); +} + +//////////////////////////////////////////////////////////////////// +// Function: WindowProperties::clear_fixed_size +// Access: Published +// Description: Removes the fixed_size specification from the properties. +//////////////////////////////////////////////////////////////////// +INLINE void WindowProperties:: +clear_fixed_size() { + _specified &= ~S_fixed_size; + _flags &= ~F_fixed_size; +} + //////////////////////////////////////////////////////////////////// // Function: WindowProperties::set_fullscreen // Access: Published diff --git a/panda/src/display/windowProperties.cxx b/panda/src/display/windowProperties.cxx index 4c076e4273..3c07779eb8 100644 --- a/panda/src/display/windowProperties.cxx +++ b/panda/src/display/windowProperties.cxx @@ -100,6 +100,9 @@ add_properties(const WindowProperties &other) { if (other.has_undecorated()) { set_undecorated(other.get_undecorated()); } + if (other.has_fixed_size()) { + set_fixed_size(other.get_fixed_size()); + } if (other.has_fullscreen()) { set_fullscreen(other.get_fullscreen()); } @@ -138,6 +141,9 @@ output(ostream &out) const { if (has_undecorated()) { out << (get_undecorated() ? "undecorated " : "!undecorated "); } + if (has_fixed_size()) { + out << (get_fixed_size() ? "fixed_size " : "!fixed_size "); + } if (has_fullscreen()) { out << (get_fullscreen() ? "fullscreen " : "!fullscreen "); } diff --git a/panda/src/display/windowProperties.h b/panda/src/display/windowProperties.h index d9cab42e4d..b550db0d69 100644 --- a/panda/src/display/windowProperties.h +++ b/panda/src/display/windowProperties.h @@ -63,6 +63,11 @@ PUBLISHED: INLINE bool has_undecorated() const; INLINE void clear_undecorated(); + INLINE void set_fixed_size(bool fixed_size); + INLINE bool get_fixed_size() const; + INLINE bool has_fixed_size() const; + INLINE void clear_fixed_size(); + INLINE void set_fullscreen(bool fullscreen); INLINE bool get_fullscreen() const; INLINE bool has_fullscreen() const; @@ -106,6 +111,7 @@ private: S_minimized = 0x0040, S_open = 0x0080, S_cursor_hidden = 0x0100, + S_fixed_size = 0x0200, }; // This bitmask represents the true/false settings for various @@ -118,6 +124,7 @@ private: F_minimized = S_minimized, F_open = S_open, F_cursor_hidden = S_cursor_hidden, + F_fixed_size = S_fixed_size, }; int _specified; diff --git a/panda/src/dxgsg7/wdxGraphicsPipe7.cxx b/panda/src/dxgsg7/wdxGraphicsPipe7.cxx index 274c5054de..6819b69972 100644 --- a/panda/src/dxgsg7/wdxGraphicsPipe7.cxx +++ b/panda/src/dxgsg7/wdxGraphicsPipe7.cxx @@ -76,11 +76,11 @@ pipe_constructor() { // Description: Creates a new window on the pipe, if possible. //////////////////////////////////////////////////////////////////// PT(GraphicsWindow) wdxGraphicsPipe7:: -make_window(GraphicsStateGuardian *gsg) { +make_window(GraphicsStateGuardian *gsg, const string &name) { // thanks to the dumb threading requirements this constructor actually does nothing but create an empty c++ object // no windows are really opened until wdxGraphicsWindow8->open_window() is called - return new wdxGraphicsWindow7(this, gsg); + return new wdxGraphicsWindow7(this, gsg, name); } diff --git a/panda/src/dxgsg7/wdxGraphicsPipe7.h b/panda/src/dxgsg7/wdxGraphicsPipe7.h index e2077edf53..d37a471f3b 100644 --- a/panda/src/dxgsg7/wdxGraphicsPipe7.h +++ b/panda/src/dxgsg7/wdxGraphicsPipe7.h @@ -37,7 +37,7 @@ public: virtual PT(GraphicsStateGuardian) make_gsg(const FrameBufferProperties &properties); protected: - virtual PT(GraphicsWindow) make_window(GraphicsStateGuardian *gsg); + virtual PT(GraphicsWindow) make_window(GraphicsStateGuardian *gsg, const string &name); private: bool init(); diff --git a/panda/src/dxgsg7/wdxGraphicsWindow7.cxx b/panda/src/dxgsg7/wdxGraphicsWindow7.cxx index e850998e3e..a3a313e624 100644 --- a/panda/src/dxgsg7/wdxGraphicsWindow7.cxx +++ b/panda/src/dxgsg7/wdxGraphicsWindow7.cxx @@ -116,8 +116,9 @@ TypeHandle wdxGraphicsWindow7::_type_handle; // Description: //////////////////////////////////////////////////////////////////// wdxGraphicsWindow7:: -wdxGraphicsWindow7(GraphicsPipe *pipe, GraphicsStateGuardian *gsg) : - WinGraphicsWindow(pipe, gsg) +wdxGraphicsWindow7(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + const string &name) : + WinGraphicsWindow(pipe, gsg, name) { _dxgsg = DCAST(DXGraphicsStateGuardian7, gsg); ZeroMemory(&_wcontext,sizeof(_wcontext)); diff --git a/panda/src/dxgsg7/wdxGraphicsWindow7.h b/panda/src/dxgsg7/wdxGraphicsWindow7.h index 3a49e59f58..bc6f698fb7 100644 --- a/panda/src/dxgsg7/wdxGraphicsWindow7.h +++ b/panda/src/dxgsg7/wdxGraphicsWindow7.h @@ -42,7 +42,8 @@ typedef HRESULT (WINAPI * LPDIRECTDRAWCREATEEX)(GUID FAR * lpGuid, LPVOID *lplp //////////////////////////////////////////////////////////////////// class EXPCL_PANDADX wdxGraphicsWindow7 : public WinGraphicsWindow { public: - wdxGraphicsWindow7(GraphicsPipe *pipe, GraphicsStateGuardian *gsg); + wdxGraphicsWindow7(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + const string &name); virtual ~wdxGraphicsWindow7(); virtual void end_flip(); //virtual bool begin_frame(); diff --git a/panda/src/dxgsg8/wdxGraphicsPipe8.cxx b/panda/src/dxgsg8/wdxGraphicsPipe8.cxx index 2e745cb11c..753e3ca237 100644 --- a/panda/src/dxgsg8/wdxGraphicsPipe8.cxx +++ b/panda/src/dxgsg8/wdxGraphicsPipe8.cxx @@ -87,14 +87,14 @@ pipe_constructor() { // Description: Creates a new window on the pipe, if possible. //////////////////////////////////////////////////////////////////// PT(GraphicsWindow) wdxGraphicsPipe8:: -make_window(GraphicsStateGuardian *gsg) { +make_window(GraphicsStateGuardian *gsg, const string &name) { if (!_is_valid) { return NULL; } // thanks to the dumb threading requirements this constructor actually does nothing but create an empty c++ object // no windows are really opened until wdxGraphicsWindow8->open_window() is called - return new wdxGraphicsWindow8(this, gsg); + return new wdxGraphicsWindow8(this, gsg, name); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/dxgsg8/wdxGraphicsPipe8.h b/panda/src/dxgsg8/wdxGraphicsPipe8.h index 8924b536ba..7647716a0f 100644 --- a/panda/src/dxgsg8/wdxGraphicsPipe8.h +++ b/panda/src/dxgsg8/wdxGraphicsPipe8.h @@ -67,7 +67,7 @@ public: bool special_check_fullscreen_resolution(DXScreenData &scrn, UINT x_size,UINT y_size); protected: - virtual PT(GraphicsWindow) make_window(GraphicsStateGuardian *gsg); + virtual PT(GraphicsWindow) make_window(GraphicsStateGuardian *gsg, const string &name); private: bool init(); diff --git a/panda/src/dxgsg8/wdxGraphicsWindow8.cxx b/panda/src/dxgsg8/wdxGraphicsWindow8.cxx index 54bd58f8cd..0fac823953 100644 --- a/panda/src/dxgsg8/wdxGraphicsWindow8.cxx +++ b/panda/src/dxgsg8/wdxGraphicsWindow8.cxx @@ -74,8 +74,9 @@ unsigned int hardcoded_modifier_buttons[NUM_MODIFIER_KEYS]={VK_SHIFT,VK_MENU,VK_ // Description: //////////////////////////////////////////////////////////////////// wdxGraphicsWindow8:: -wdxGraphicsWindow8(GraphicsPipe *pipe, GraphicsStateGuardian *gsg) : - WinGraphicsWindow(pipe, gsg) +wdxGraphicsWindow8(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + const string &name) : + WinGraphicsWindow(pipe, gsg, name) { // dont actually create the window in the constructor. reason: multi-threading requires // panda C++ window object to exist in separate thread from actual API window diff --git a/panda/src/dxgsg8/wdxGraphicsWindow8.h b/panda/src/dxgsg8/wdxGraphicsWindow8.h index b50100a146..8f779425c9 100644 --- a/panda/src/dxgsg8/wdxGraphicsWindow8.h +++ b/panda/src/dxgsg8/wdxGraphicsWindow8.h @@ -39,7 +39,8 @@ static const int WDXWIN_EVENT = 8; //////////////////////////////////////////////////////////////////// class EXPCL_PANDADX wdxGraphicsWindow8 : public WinGraphicsWindow { public: - wdxGraphicsWindow8(GraphicsPipe *pipe, GraphicsStateGuardian *gsg); + wdxGraphicsWindow8(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + const string &name); virtual ~wdxGraphicsWindow8(); virtual bool open_window(void); virtual void reset_window(bool swapchain); diff --git a/panda/src/dxgsg9/wdxGraphicsPipe9.cxx b/panda/src/dxgsg9/wdxGraphicsPipe9.cxx index f551e18959..1e4875cca7 100755 --- a/panda/src/dxgsg9/wdxGraphicsPipe9.cxx +++ b/panda/src/dxgsg9/wdxGraphicsPipe9.cxx @@ -87,14 +87,14 @@ pipe_constructor() { // Description: Creates a new window on the pipe, if possible. //////////////////////////////////////////////////////////////////// PT(GraphicsWindow) wdxGraphicsPipe9:: -make_window(GraphicsStateGuardian *gsg) { +make_window(GraphicsStateGuardian *gsg, const string &name) { if (!_is_valid) { return NULL; } // thanks to the dumb threading requirements this constructor actually does nothing but create an empty c++ object // no windows are really opened until wdxGraphicsWindow9->open_window() is called - return new wdxGraphicsWindow9(this, gsg); + return new wdxGraphicsWindow9(this, gsg, name); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/dxgsg9/wdxGraphicsPipe9.h b/panda/src/dxgsg9/wdxGraphicsPipe9.h index 7407866c82..870f6d6924 100755 --- a/panda/src/dxgsg9/wdxGraphicsPipe9.h +++ b/panda/src/dxgsg9/wdxGraphicsPipe9.h @@ -67,7 +67,7 @@ public: bool special_check_fullscreen_resolution(DXScreenData &scrn, UINT x_size,UINT y_size); protected: - virtual PT(GraphicsWindow) make_window(GraphicsStateGuardian *gsg); + virtual PT(GraphicsWindow) make_window(GraphicsStateGuardian *gsg, const string &name); private: bool init(); diff --git a/panda/src/dxgsg9/wdxGraphicsWindow9.cxx b/panda/src/dxgsg9/wdxGraphicsWindow9.cxx index 061b9f4313..991dedea20 100755 --- a/panda/src/dxgsg9/wdxGraphicsWindow9.cxx +++ b/panda/src/dxgsg9/wdxGraphicsWindow9.cxx @@ -74,8 +74,9 @@ unsigned int hardcoded_modifier_buttons[NUM_MODIFIER_KEYS]={VK_SHIFT,VK_MENU,VK_ // Description: //////////////////////////////////////////////////////////////////// wdxGraphicsWindow9:: -wdxGraphicsWindow9(GraphicsPipe *pipe, GraphicsStateGuardian *gsg) : - WinGraphicsWindow(pipe, gsg) +wdxGraphicsWindow9(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + const string &name) : + WinGraphicsWindow(pipe, gsg, name) { // dont actually create the window in the constructor. reason: multi-threading requires // panda C++ window object to exist in separate thread from actual API window diff --git a/panda/src/dxgsg9/wdxGraphicsWindow9.h b/panda/src/dxgsg9/wdxGraphicsWindow9.h index f9f1d09d4b..66e4e246fa 100755 --- a/panda/src/dxgsg9/wdxGraphicsWindow9.h +++ b/panda/src/dxgsg9/wdxGraphicsWindow9.h @@ -39,7 +39,8 @@ static const int WDXWIN_EVENT = 8; //////////////////////////////////////////////////////////////////// class EXPCL_PANDADX wdxGraphicsWindow9 : public WinGraphicsWindow { public: - wdxGraphicsWindow9(GraphicsPipe *pipe, GraphicsStateGuardian *gsg); + wdxGraphicsWindow9(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + const string &name); virtual ~wdxGraphicsWindow9(); virtual bool open_window(void); virtual void reset_window(bool swapchain); diff --git a/panda/src/framework/windowFramework.cxx b/panda/src/framework/windowFramework.cxx index f9fd805984..7fa5250a94 100644 --- a/panda/src/framework/windowFramework.cxx +++ b/panda/src/framework/windowFramework.cxx @@ -111,7 +111,13 @@ open_window(const WindowProperties &props, GraphicsEngine *engine, } } - _window = engine->make_window(pipe, ptgsg); + static int next_window_index = 1; + ostringstream stream; + stream << "window" << next_window_index; + next_window_index++; + string name = stream.str(); + + _window = engine->make_window(pipe, ptgsg, name); if (_window != (GraphicsWindow *)NULL) { _window->request_properties(props); set_background_type(_background_type); diff --git a/panda/src/glxdisplay/glxGraphicsBuffer.cxx b/panda/src/glxdisplay/glxGraphicsBuffer.cxx index d380eacbf9..511830ba95 100644 --- a/panda/src/glxdisplay/glxGraphicsBuffer.cxx +++ b/panda/src/glxdisplay/glxGraphicsBuffer.cxx @@ -34,8 +34,9 @@ TypeHandle glxGraphicsBuffer::_type_handle; //////////////////////////////////////////////////////////////////// glxGraphicsBuffer:: glxGraphicsBuffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + const string &name, int x_size, int y_size, bool want_texture) : - GraphicsBuffer(pipe, gsg, x_size, y_size, want_texture) + GraphicsBuffer(pipe, gsg, name, x_size, y_size, want_texture) { glxGraphicsPipe *glx_pipe; DCAST_INTO_V(glx_pipe, _pipe); @@ -90,25 +91,6 @@ release_gsg() { GraphicsBuffer::release_gsg(); } -//////////////////////////////////////////////////////////////////// -// Function: glxGraphicsBuffer::end_frame -// Access: Public, Virtual -// Description: This function will be called within the draw thread -// after rendering is completed for a given frame. It -// should do whatever finalization is required. -//////////////////////////////////////////////////////////////////// -void glxGraphicsBuffer:: -end_frame() { - if (has_texture()) { - // Use glCopyTexImage2D to copy the framebuffer to the texture. - // This appears to be the only way to "render to a texture" in - // OpenGL; there's no interface to make the offscreen buffer - // itself be a texture. - DisplayRegion dr(_x_size, _y_size); - get_texture()->copy(_gsg, &dr, _gsg->get_render_buffer(RenderBuffer::T_back)); - } -} - //////////////////////////////////////////////////////////////////// // Function: glxGraphicsBuffer::close_buffer // Access: Protected, Virtual diff --git a/panda/src/glxdisplay/glxGraphicsBuffer.h b/panda/src/glxdisplay/glxGraphicsBuffer.h index 797e75842a..18357459f5 100644 --- a/panda/src/glxdisplay/glxGraphicsBuffer.h +++ b/panda/src/glxdisplay/glxGraphicsBuffer.h @@ -32,6 +32,7 @@ class glxGraphicsBuffer : public GraphicsBuffer { public: glxGraphicsBuffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + const string &name, int x_size, int y_size, bool want_texture); virtual ~glxGraphicsBuffer(); @@ -39,8 +40,6 @@ public: virtual void make_current(); virtual void release_gsg(); - virtual void end_frame(); - protected: virtual void close_buffer(); virtual bool open_buffer(); diff --git a/panda/src/glxdisplay/glxGraphicsPipe.cxx b/panda/src/glxdisplay/glxGraphicsPipe.cxx index 29f2758f49..10682cdd61 100644 --- a/panda/src/glxdisplay/glxGraphicsPipe.cxx +++ b/panda/src/glxdisplay/glxGraphicsPipe.cxx @@ -194,12 +194,12 @@ make_gsg(const FrameBufferProperties &properties) { // Description: Creates a new window on the pipe, if possible. //////////////////////////////////////////////////////////////////// PT(GraphicsWindow) glxGraphicsPipe:: -make_window(GraphicsStateGuardian *gsg) { +make_window(GraphicsStateGuardian *gsg, const string &name) { if (!_is_valid) { return NULL; } - return new glxGraphicsWindow(this, gsg); + return new glxGraphicsWindow(this, gsg, name); } //////////////////////////////////////////////////////////////////// @@ -208,12 +208,13 @@ make_window(GraphicsStateGuardian *gsg) { // Description: Creates a new offscreen buffer on the pipe, if possible. //////////////////////////////////////////////////////////////////// PT(GraphicsBuffer) glxGraphicsPipe:: -make_buffer(GraphicsStateGuardian *gsg, int x_size, int y_size, bool want_texture) { +make_buffer(GraphicsStateGuardian *gsg, const string &name, + int x_size, int y_size, bool want_texture) { if (!_is_valid) { return NULL; } - return new glxGraphicsBuffer(this, gsg, x_size, y_size, want_texture); + return new glxGraphicsBuffer(this, gsg, name, x_size, y_size, want_texture); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/glxdisplay/glxGraphicsPipe.h b/panda/src/glxdisplay/glxGraphicsPipe.h index 1f4784cc0e..89eeee67db 100644 --- a/panda/src/glxdisplay/glxGraphicsPipe.h +++ b/panda/src/glxdisplay/glxGraphicsPipe.h @@ -79,8 +79,10 @@ public: protected: virtual PT(GraphicsStateGuardian) make_gsg(const FrameBufferProperties &properties); - virtual PT(GraphicsWindow) make_window(GraphicsStateGuardian *gsg); + virtual PT(GraphicsWindow) make_window(GraphicsStateGuardian *gsg, + const string &name); virtual PT(GraphicsBuffer) make_buffer(GraphicsStateGuardian *gsg, + const string &name, int x_size, int y_size, bool want_texture); private: diff --git a/panda/src/glxdisplay/glxGraphicsWindow.cxx b/panda/src/glxdisplay/glxGraphicsWindow.cxx index 164aeb6ae1..287bb86822 100644 --- a/panda/src/glxdisplay/glxGraphicsWindow.cxx +++ b/panda/src/glxdisplay/glxGraphicsWindow.cxx @@ -41,8 +41,9 @@ TypeHandle glxGraphicsWindow::_type_handle; // Description: //////////////////////////////////////////////////////////////////// glxGraphicsWindow:: -glxGraphicsWindow(GraphicsPipe *pipe, GraphicsStateGuardian *gsg) : - GraphicsWindow(pipe, gsg) +glxGraphicsWindow(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + const string &name) : + GraphicsWindow(pipe, gsg, name) { glxGraphicsPipe *glx_pipe; DCAST_INTO_V(glx_pipe, _pipe); @@ -209,8 +210,28 @@ process_events() { case ConfigureNotify: _awaiting_configure = false; - properties.set_size(event.xconfigure.width, event.xconfigure.height); - system_changed_properties(properties); + if (_properties.get_fixed_size()) { + // If the window properties indicate a fixed size only, undo + // any attempt by the user to change them. In X, there + // doesn't appear to be a way to universally disallow this + // directly (although we do set the min_size and max_size to + // the same value, which seems to work for most window + // managers.) + WindowProperties current_props = get_properties(); + if (event.xconfigure.width != current_props.get_x_size() || + event.xconfigure.height != current_props.get_y_size()) { + XWindowChanges changes; + changes.width = current_props.get_x_size(); + changes.height = current_props.get_y_size(); + int value_mask = (CWWidth | CWHeight); + XConfigureWindow(_display, _xwindow, value_mask, &changes); + } + + } else { + // A normal window may be resized by the user at will. + properties.set_size(event.xconfigure.width, event.xconfigure.height); + system_changed_properties(properties); + } break; case ButtonPress: @@ -524,6 +545,14 @@ set_wm_properties(const WindowProperties &properties) { size_hints_p->width = properties.get_x_size(); size_hints_p->height = properties.get_y_size(); size_hints_p->flags |= USSize; + + if (properties.has_fixed_size()) { + size_hints_p->min_width = properties.get_x_size(); + size_hints_p->min_height = properties.get_y_size(); + size_hints_p->max_width = properties.get_x_size(); + size_hints_p->max_height = properties.get_y_size(); + size_hints_p->flags |= (PMinSize | PMaxSize); + } } } } diff --git a/panda/src/glxdisplay/glxGraphicsWindow.h b/panda/src/glxdisplay/glxGraphicsWindow.h index 13f19017aa..92a83e4316 100644 --- a/panda/src/glxdisplay/glxGraphicsWindow.h +++ b/panda/src/glxdisplay/glxGraphicsWindow.h @@ -32,7 +32,8 @@ //////////////////////////////////////////////////////////////////// class glxGraphicsWindow : public GraphicsWindow { public: - glxGraphicsWindow(GraphicsPipe *pipe, GraphicsStateGuardian *gsg); + glxGraphicsWindow(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + const string &name); virtual ~glxGraphicsWindow(); virtual void make_current(); diff --git a/panda/src/mesadisplay/osMesaGraphicsBuffer.cxx b/panda/src/mesadisplay/osMesaGraphicsBuffer.cxx index e651c6a0e0..86471835b0 100644 --- a/panda/src/mesadisplay/osMesaGraphicsBuffer.cxx +++ b/panda/src/mesadisplay/osMesaGraphicsBuffer.cxx @@ -30,8 +30,9 @@ TypeHandle OsMesaGraphicsBuffer::_type_handle; //////////////////////////////////////////////////////////////////// OsMesaGraphicsBuffer:: OsMesaGraphicsBuffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, - int x_size, int y_size, bool want_texture) : - GraphicsBuffer(pipe, gsg, x_size, y_size, want_texture) + const string &name, + int x_size, int y_size, bool want_texture) : + GraphicsBuffer(pipe, gsg, name, x_size, y_size, want_texture) { _type = GL_UNSIGNED_BYTE; } diff --git a/panda/src/mesadisplay/osMesaGraphicsBuffer.h b/panda/src/mesadisplay/osMesaGraphicsBuffer.h index f2caff8a7d..250b076070 100644 --- a/panda/src/mesadisplay/osMesaGraphicsBuffer.h +++ b/panda/src/mesadisplay/osMesaGraphicsBuffer.h @@ -33,7 +33,8 @@ class EXPCL_PANDAMESA OsMesaGraphicsBuffer : public GraphicsBuffer { public: OsMesaGraphicsBuffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, - int x_size, int y_size, bool want_texture); + const string &name, + int x_size, int y_size, bool want_texture); virtual ~OsMesaGraphicsBuffer(); diff --git a/panda/src/mesadisplay/osMesaGraphicsPipe.cxx b/panda/src/mesadisplay/osMesaGraphicsPipe.cxx index f413c97cf1..edffa68f69 100644 --- a/panda/src/mesadisplay/osMesaGraphicsPipe.cxx +++ b/panda/src/mesadisplay/osMesaGraphicsPipe.cxx @@ -90,6 +90,7 @@ make_gsg(const FrameBufferProperties &properties) { // Description: Creates a new offscreen buffer on the pipe, if possible. //////////////////////////////////////////////////////////////////// PT(GraphicsBuffer) OsMesaGraphicsPipe:: -make_buffer(GraphicsStateGuardian *gsg, int x_size, int y_size, bool want_texture) { - return new OsMesaGraphicsBuffer(this, gsg, x_size, y_size, want_texture); +make_buffer(GraphicsStateGuardian *gsg, const string &name, + int x_size, int y_size, bool want_texture) { + return new OsMesaGraphicsBuffer(this, gsg, name, x_size, y_size, want_texture); } diff --git a/panda/src/mesadisplay/osMesaGraphicsPipe.h b/panda/src/mesadisplay/osMesaGraphicsPipe.h index 0c4e1d4956..657b6303ea 100644 --- a/panda/src/mesadisplay/osMesaGraphicsPipe.h +++ b/panda/src/mesadisplay/osMesaGraphicsPipe.h @@ -48,6 +48,7 @@ public: protected: virtual PT(GraphicsStateGuardian) make_gsg(const FrameBufferProperties &properties); virtual PT(GraphicsBuffer) make_buffer(GraphicsStateGuardian *gsg, + const string &name, int x_size, int y_size, bool want_texture); private: diff --git a/panda/src/wgldisplay/wglGraphicsBuffer.cxx b/panda/src/wgldisplay/wglGraphicsBuffer.cxx index d08a7e1b89..ea7635fd15 100644 --- a/panda/src/wgldisplay/wglGraphicsBuffer.cxx +++ b/panda/src/wgldisplay/wglGraphicsBuffer.cxx @@ -35,8 +35,9 @@ bool wglGraphicsBuffer::_window_class_registered = false; //////////////////////////////////////////////////////////////////// wglGraphicsBuffer:: wglGraphicsBuffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + const string &name, int x_size, int y_size, bool want_texture) : - GraphicsBuffer(pipe, gsg, x_size, y_size, want_texture) + GraphicsBuffer(pipe, gsg, name, x_size, y_size, want_texture) { _window = (HWND)0; _window_dc = (HDC)0; diff --git a/panda/src/wgldisplay/wglGraphicsBuffer.h b/panda/src/wgldisplay/wglGraphicsBuffer.h index 6103be16c3..8f1a40dc02 100644 --- a/panda/src/wgldisplay/wglGraphicsBuffer.h +++ b/panda/src/wgldisplay/wglGraphicsBuffer.h @@ -42,6 +42,7 @@ class EXPCL_PANDAGL wglGraphicsBuffer : public GraphicsBuffer { public: wglGraphicsBuffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + const string &name, int x_size, int y_size, bool want_texture); virtual ~wglGraphicsBuffer(); diff --git a/panda/src/wgldisplay/wglGraphicsPipe.cxx b/panda/src/wgldisplay/wglGraphicsPipe.cxx index a5693a42cc..96cb2f7135 100644 --- a/panda/src/wgldisplay/wglGraphicsPipe.cxx +++ b/panda/src/wgldisplay/wglGraphicsPipe.cxx @@ -120,8 +120,8 @@ make_gsg(const FrameBufferProperties &properties) { // Description: Creates a new window on the pipe, if possible. //////////////////////////////////////////////////////////////////// PT(GraphicsWindow) wglGraphicsPipe:: -make_window(GraphicsStateGuardian *gsg) { - return new wglGraphicsWindow(this, gsg); +make_window(GraphicsStateGuardian *gsg, const string &name) { + return new wglGraphicsWindow(this, gsg, name); } //////////////////////////////////////////////////////////////////// @@ -130,9 +130,9 @@ make_window(GraphicsStateGuardian *gsg) { // Description: Creates a new offscreen buffer on the pipe, if possible. //////////////////////////////////////////////////////////////////// PT(GraphicsBuffer) wglGraphicsPipe:: -make_buffer(GraphicsStateGuardian *gsg, int x_size, int y_size, - bool want_texture) { - return new wglGraphicsBuffer(this, gsg, x_size, y_size, want_texture); +make_buffer(GraphicsStateGuardian *gsg, const string &name, + int x_size, int y_size, bool want_texture) { + return new wglGraphicsBuffer(this, gsg, name, x_size, y_size, want_texture); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/wgldisplay/wglGraphicsPipe.h b/panda/src/wgldisplay/wglGraphicsPipe.h index 6dbd51d912..5135f08d7f 100644 --- a/panda/src/wgldisplay/wglGraphicsPipe.h +++ b/panda/src/wgldisplay/wglGraphicsPipe.h @@ -38,8 +38,10 @@ public: protected: virtual PT(GraphicsStateGuardian) make_gsg(const FrameBufferProperties &properties); - virtual PT(GraphicsWindow) make_window(GraphicsStateGuardian *gsg); + virtual PT(GraphicsWindow) make_window(GraphicsStateGuardian *gsg, + const string &name); virtual PT(GraphicsBuffer) make_buffer(GraphicsStateGuardian *gsg, + const string &name, int x_size, int y_size, bool want_texture); private: static int choose_pfnum(FrameBufferProperties &properties, HDC hdc); diff --git a/panda/src/wgldisplay/wglGraphicsWindow.cxx b/panda/src/wgldisplay/wglGraphicsWindow.cxx index 1211ae824e..34bff4ba03 100644 --- a/panda/src/wgldisplay/wglGraphicsWindow.cxx +++ b/panda/src/wgldisplay/wglGraphicsWindow.cxx @@ -130,8 +130,9 @@ GetAvailVidMem() { // Description: //////////////////////////////////////////////////////////////////// wglGraphicsWindow:: -wglGraphicsWindow(GraphicsPipe *pipe, GraphicsStateGuardian *gsg) : - WinGraphicsWindow(pipe, gsg) +wglGraphicsWindow(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + const string &name) : + WinGraphicsWindow(pipe, gsg, name) { _hdc = (HDC)0; } diff --git a/panda/src/wgldisplay/wglGraphicsWindow.h b/panda/src/wgldisplay/wglGraphicsWindow.h index aae20e5947..2a73cbaa61 100644 --- a/panda/src/wgldisplay/wglGraphicsWindow.h +++ b/panda/src/wgldisplay/wglGraphicsWindow.h @@ -29,7 +29,8 @@ //////////////////////////////////////////////////////////////////// class EXPCL_PANDAGL wglGraphicsWindow : public WinGraphicsWindow { public: - wglGraphicsWindow(GraphicsPipe *pipe, GraphicsStateGuardian *gsg); + wglGraphicsWindow(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + const string &name); virtual ~wglGraphicsWindow(); virtual void make_current(); diff --git a/panda/src/windisplay/winGraphicsWindow.cxx b/panda/src/windisplay/winGraphicsWindow.cxx index d71b36db11..6ca4efd765 100644 --- a/panda/src/windisplay/winGraphicsWindow.cxx +++ b/panda/src/windisplay/winGraphicsWindow.cxx @@ -56,8 +56,9 @@ static const char * const errorbox_title = "Panda3D Error"; // Description: //////////////////////////////////////////////////////////////////// WinGraphicsWindow:: -WinGraphicsWindow(GraphicsPipe *pipe, GraphicsStateGuardian *gsg) : - GraphicsWindow(pipe, gsg) +WinGraphicsWindow(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + const string &name) : + GraphicsWindow(pipe, gsg, name) { GraphicsWindowInputDevice device = GraphicsWindowInputDevice::pointer_and_keyboard("keyboard/mouse"); diff --git a/panda/src/windisplay/winGraphicsWindow.h b/panda/src/windisplay/winGraphicsWindow.h index 50007d0bac..8c9a0a5ddc 100644 --- a/panda/src/windisplay/winGraphicsWindow.h +++ b/panda/src/windisplay/winGraphicsWindow.h @@ -22,11 +22,7 @@ #include "pandabase.h" #include "graphicsWindow.h" -// Jesse thinks that this is supposed to say WIN32_LEAN_AND_MEAN, but he -// doesn't want to fix what isn't broken. -#define WINDOWS_LEAN_AND_MEAN #include -#undef WINDOWS_LEAN_AND_MEAN class WinGraphicsPipe; @@ -45,7 +41,8 @@ class WinGraphicsPipe; //////////////////////////////////////////////////////////////////// class EXPCL_PANDAWIN WinGraphicsWindow : public GraphicsWindow { public: - WinGraphicsWindow(GraphicsPipe *pipe, GraphicsStateGuardian *gsg); + WinGraphicsWindow(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + const string &name); virtual ~WinGraphicsWindow(); virtual void begin_flip();