add name to GraphicsWindow constructor; add fixed_size to WindowProperties, add show-buffers to Configrc
This commit is contained in:
parent
4d416cce51
commit
761c0e78fc
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 ");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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 <windows.h>
|
||||
#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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue