From be50ac2d7394c1af659d51f5cee51f94b9751eed Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 9 Feb 2004 21:58:47 +0000 Subject: [PATCH] define mesadisplay --- panda/metalibs/pandagl/Sources.pp | 2 +- panda/src/mesadisplay/Sources.pp | 22 ++++ panda/src/mesadisplay/config_mesadisplay.cxx | 57 +++++++++ panda/src/mesadisplay/config_mesadisplay.h | 29 +++++ panda/src/mesadisplay/mesaGraphicsBuffer.I | 18 +++ panda/src/mesadisplay/mesaGraphicsBuffer.cxx | 115 ++++++++++++++++++ panda/src/mesadisplay/mesaGraphicsBuffer.h | 72 +++++++++++ panda/src/mesadisplay/mesaGraphicsPipe.I | 18 +++ panda/src/mesadisplay/mesaGraphicsPipe.cxx | 95 +++++++++++++++ panda/src/mesadisplay/mesaGraphicsPipe.h | 76 ++++++++++++ .../mesadisplay/mesaGraphicsStateGuardian.I | 17 +++ .../mesadisplay/mesaGraphicsStateGuardian.cxx | 46 +++++++ .../mesadisplay/mesaGraphicsStateGuardian.h | 59 +++++++++ 13 files changed, 625 insertions(+), 1 deletion(-) create mode 100644 panda/src/mesadisplay/Sources.pp create mode 100644 panda/src/mesadisplay/config_mesadisplay.cxx create mode 100644 panda/src/mesadisplay/config_mesadisplay.h create mode 100644 panda/src/mesadisplay/mesaGraphicsBuffer.I create mode 100644 panda/src/mesadisplay/mesaGraphicsBuffer.cxx create mode 100644 panda/src/mesadisplay/mesaGraphicsBuffer.h create mode 100644 panda/src/mesadisplay/mesaGraphicsPipe.I create mode 100644 panda/src/mesadisplay/mesaGraphicsPipe.cxx create mode 100644 panda/src/mesadisplay/mesaGraphicsPipe.h create mode 100644 panda/src/mesadisplay/mesaGraphicsStateGuardian.I create mode 100644 panda/src/mesadisplay/mesaGraphicsStateGuardian.cxx create mode 100644 panda/src/mesadisplay/mesaGraphicsStateGuardian.h diff --git a/panda/metalibs/pandagl/Sources.pp b/panda/metalibs/pandagl/Sources.pp index 6d1a7459e2..ac0185b21a 100644 --- a/panda/metalibs/pandagl/Sources.pp +++ b/panda/metalibs/pandagl/Sources.pp @@ -12,7 +12,7 @@ // We don't have any components if we're linking the GL library // directly into Panda. #define COMPONENT_LIBS \ - glgsg glxdisplay \ + glgsg glxdisplay mesadisplay \ wgldisplay #endif diff --git a/panda/src/mesadisplay/Sources.pp b/panda/src/mesadisplay/Sources.pp new file mode 100644 index 0000000000..ac519b4f51 --- /dev/null +++ b/panda/src/mesadisplay/Sources.pp @@ -0,0 +1,22 @@ +#define BUILD_DIRECTORY $[HAVE_MESA] + +#define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \ + dtoolutil:c dtoolbase:c dtool:m +#define USE_PACKAGES gl mesa + +#begin lib_target + #define TARGET mesadisplay + #define LOCAL_LIBS \ + glgsg + + #define SOURCES \ + config_mesadisplay.cxx config_mesadisplay.h \ + mesaGraphicsBuffer.I mesaGraphicsBuffer.cxx mesaGraphicsBuffer.h \ + mesaGraphicsPipe.I mesaGraphicsPipe.cxx mesaGraphicsPipe.h \ + mesaGraphicsStateGuardian.h mesaGraphicsStateGuardian.cxx \ + mesaGraphicsStateGuardian.I + + #define IGATESCAN mesaGraphicsPipe.h + +#end lib_target + diff --git a/panda/src/mesadisplay/config_mesadisplay.cxx b/panda/src/mesadisplay/config_mesadisplay.cxx new file mode 100644 index 0000000000..6a9e0401ad --- /dev/null +++ b/panda/src/mesadisplay/config_mesadisplay.cxx @@ -0,0 +1,57 @@ +// Filename: config_mesadisplay.cxx +// Created by: drose (09Feb04) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved +// +// All use of this software is subject to the terms of the Panda 3d +// Software license. You should have received a copy of this license +// along with this source code; you will also find a current copy of +// the license at http://www.panda3d.org/license.txt . +// +// To contact the maintainers of this program write to +// panda3d@yahoogroups.com . +// +//////////////////////////////////////////////////////////////////// + +#include "config_mesadisplay.h" +#include "mesaGraphicsBuffer.h" +#include "mesaGraphicsPipe.h" +#include "mesaGraphicsStateGuardian.h" +#include "graphicsPipeSelection.h" +#include "dconfig.h" + +Configure(config_mesadisplay); +NotifyCategoryDef(mesadisplay, "display"); + +ConfigureFn(config_mesadisplay) { + init_libmesadisplay(); +} + +//////////////////////////////////////////////////////////////////// +// Function: init_libmesadisplay +// Description: Initializes the library. This must be called at +// least once before any of the functions or classes in +// this library can be used. Normally it will be +// called by the static initializers and need not be +// called explicitly, but special cases exist. +//////////////////////////////////////////////////////////////////// +void +init_libmesadisplay() { + static bool initialized = false; + if (initialized) { + return; + } + initialized = true; + + MesaGraphicsBuffer::init_type(); + MesaGraphicsPipe::init_type(); + MesaGraphicsStateGuardian::init_type(); + + cerr << "Adding MesaGraphicsPipe\n"; + GraphicsPipeSelection *selection = GraphicsPipeSelection::get_global_ptr(); + selection->add_pipe_type(MesaGraphicsPipe::get_class_type(), + MesaGraphicsPipe::pipe_constructor); +} diff --git a/panda/src/mesadisplay/config_mesadisplay.h b/panda/src/mesadisplay/config_mesadisplay.h new file mode 100644 index 0000000000..629afe19e0 --- /dev/null +++ b/panda/src/mesadisplay/config_mesadisplay.h @@ -0,0 +1,29 @@ +// Filename: config_mesadisplay.h +// Created by: drose (09Feb04) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved +// +// All use of this software is subject to the terms of the Panda 3d +// Software license. You should have received a copy of this license +// along with this source code; you will also find a current copy of +// the license at http://www.panda3d.org/license.txt . +// +// To contact the maintainers of this program write to +// panda3d@yahoogroups.com . +// +//////////////////////////////////////////////////////////////////// + +#ifndef CONFIG_MESADISPLAY_H +#define CONFIG_MESADISPLAY_H + +#include "pandabase.h" +#include "notifyCategoryProxy.h" + +NotifyCategoryDecl(mesadisplay, EXPCL_PANDAGL, EXPTP_PANDAGL); + +extern EXPCL_PANDAGL void init_libmesadisplay(); + +#endif diff --git a/panda/src/mesadisplay/mesaGraphicsBuffer.I b/panda/src/mesadisplay/mesaGraphicsBuffer.I new file mode 100644 index 0000000000..8d18eec6bb --- /dev/null +++ b/panda/src/mesadisplay/mesaGraphicsBuffer.I @@ -0,0 +1,18 @@ +// Filename: mesaGraphicsBuffer.I +// Created by: drose (09Feb04) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved +// +// All use of this software is subject to the terms of the Panda 3d +// Software license. You should have received a copy of this license +// along with this source code; you will also find a current copy of +// the license at http://www.panda3d.org/license.txt . +// +// To contact the maintainers of this program write to +// panda3d@yahoogroups.com . +// +//////////////////////////////////////////////////////////////////// + diff --git a/panda/src/mesadisplay/mesaGraphicsBuffer.cxx b/panda/src/mesadisplay/mesaGraphicsBuffer.cxx new file mode 100644 index 0000000000..407f60b640 --- /dev/null +++ b/panda/src/mesadisplay/mesaGraphicsBuffer.cxx @@ -0,0 +1,115 @@ +// Filename: mesaGraphicsBuffer.cxx +// Created by: drose (09Feb04) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved +// +// All use of this software is subject to the terms of the Panda 3d +// Software license. You should have received a copy of this license +// along with this source code; you will also find a current copy of +// the license at http://www.panda3d.org/license.txt . +// +// To contact the maintainers of this program write to +// panda3d@yahoogroups.com . +// +//////////////////////////////////////////////////////////////////// + +#include "mesaGraphicsBuffer.h" +#include "config_mesadisplay.h" +#include "mesaGraphicsPipe.h" +#include "mesaGraphicsStateGuardian.h" + +TypeHandle MesaGraphicsBuffer::_type_handle; + +//////////////////////////////////////////////////////////////////// +// Function: MesaGraphicsBuffer::Constructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +MesaGraphicsBuffer:: +MesaGraphicsBuffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + int x_size, int y_size, bool want_texture) : + GraphicsBuffer(pipe, gsg, x_size, y_size, want_texture) +{ + _type = GL_UNSIGNED_BYTE; +} + +//////////////////////////////////////////////////////////////////// +// Function: MesaGraphicsBuffer::Destructor +// Access: Public, Virtual +// Description: +//////////////////////////////////////////////////////////////////// +MesaGraphicsBuffer:: +~MesaGraphicsBuffer() { +} + +//////////////////////////////////////////////////////////////////// +// Function: MesaGraphicsBuffer::make_current +// Access: Public, Virtual +// Description: This function will be called within the draw thread +// during begin_frame() to ensure the graphics context +// is ready for drawing. +//////////////////////////////////////////////////////////////////// +void MesaGraphicsBuffer:: +make_current() { + MesaGraphicsStateGuardian *mesagsg; + DCAST_INTO_V(mesagsg, _gsg); + OSMesaMakeCurrent(mesagsg->_context, _image.p(), _type, + _x_size, _y_size); + + mesagsg->reset_if_new(); +} + +//////////////////////////////////////////////////////////////////// +// Function: MesaGraphicsBuffer::begin_flip +// Access: Public, Virtual +// Description: This function will be called within the draw thread +// after end_frame() has been called on all windows, to +// initiate the exchange of the front and back buffers. +// +// This should instruct the window to prepare for the +// flip at the next video sync, but it should not wait. +// +// We have the two separate functions, begin_flip() and +// end_flip(), to make it easier to flip all of the +// windows at the same time. +//////////////////////////////////////////////////////////////////// +void MesaGraphicsBuffer:: +begin_flip() { + 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: MesaGraphicsBuffer::close_buffer +// Access: Protected, Virtual +// Description: Closes the buffer right now. Called from the window +// thread. +//////////////////////////////////////////////////////////////////// +void MesaGraphicsBuffer:: +close_buffer() { + _image.clear(); + _is_valid = false; +} + +//////////////////////////////////////////////////////////////////// +// Function: MesaGraphicsBuffer::open_buffer +// Access: Protected, Virtual +// Description: Opens the buffer right now. Called from the window +// thread. Returns true if the buffer is successfully +// opened, or false if there was a problem. +//////////////////////////////////////////////////////////////////// +bool MesaGraphicsBuffer:: +open_buffer() { + _image = PTA_uchar::empty_array(_x_size * _y_size * 4); + _is_valid = true; + return true; +} diff --git a/panda/src/mesadisplay/mesaGraphicsBuffer.h b/panda/src/mesadisplay/mesaGraphicsBuffer.h new file mode 100644 index 0000000000..f7505029af --- /dev/null +++ b/panda/src/mesadisplay/mesaGraphicsBuffer.h @@ -0,0 +1,72 @@ +// Filename: mesaGraphicsBuffer.h +// Created by: drose (09Feb04) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved +// +// All use of this software is subject to the terms of the Panda 3d +// Software license. You should have received a copy of this license +// along with this source code; you will also find a current copy of +// the license at http://www.panda3d.org/license.txt . +// +// To contact the maintainers of this program write to +// panda3d@yahoogroups.com . +// +//////////////////////////////////////////////////////////////////// + +#ifndef MESAGRAPHICSBUFFER_H +#define MESAGRAPHICSBUFFER_H + +#include "pandabase.h" + +#include "mesaGraphicsPipe.h" +#include "graphicsBuffer.h" + +//////////////////////////////////////////////////////////////////// +// Class : MesaGraphicsBuffer +// Description : An offscreen buffer using direct calls to Mesa. This +// is the only kind of graphics output supported by +// osmesa.h. +//////////////////////////////////////////////////////////////////// +class MesaGraphicsBuffer : public GraphicsBuffer { +public: + MesaGraphicsBuffer(GraphicsPipe *pipe, GraphicsStateGuardian *gsg, + int x_size, int y_size, bool want_texture); + + virtual ~MesaGraphicsBuffer(); + + virtual void make_current(); + + virtual void begin_flip(); + +protected: + virtual void close_buffer(); + virtual bool open_buffer(); + +private: + GLenum _type; + PTA_uchar _image; + +public: + static TypeHandle get_class_type() { + return _type_handle; + } + static void init_type() { + GraphicsBuffer::init_type(); + register_type(_type_handle, "MesaGraphicsBuffer", + GraphicsBuffer::get_class_type()); + } + virtual TypeHandle get_type() const { + return get_class_type(); + } + virtual TypeHandle force_init_type() {init_type(); return get_class_type();} + +private: + static TypeHandle _type_handle; +}; + +#include "mesaGraphicsBuffer.I" + +#endif diff --git a/panda/src/mesadisplay/mesaGraphicsPipe.I b/panda/src/mesadisplay/mesaGraphicsPipe.I new file mode 100644 index 0000000000..4b984fe9ca --- /dev/null +++ b/panda/src/mesadisplay/mesaGraphicsPipe.I @@ -0,0 +1,18 @@ +// Filename: mesaGraphicsPipe.I +// Created by: drose (09Feb04) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved +// +// All use of this software is subject to the terms of the Panda 3d +// Software license. You should have received a copy of this license +// along with this source code; you will also find a current copy of +// the license at http://www.panda3d.org/license.txt . +// +// To contact the maintainers of this program write to +// panda3d@yahoogroups.com . +// +//////////////////////////////////////////////////////////////////// + diff --git a/panda/src/mesadisplay/mesaGraphicsPipe.cxx b/panda/src/mesadisplay/mesaGraphicsPipe.cxx new file mode 100644 index 0000000000..f5a547f7a4 --- /dev/null +++ b/panda/src/mesadisplay/mesaGraphicsPipe.cxx @@ -0,0 +1,95 @@ +// Filename: mesaGraphicsPipe.cxx +// Created by: mike (09Jan97) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved +// +// All use of this software is subject to the terms of the Panda 3d +// Software license. You should have received a copy of this license +// along with this source code; you will also find a current copy of +// the license at http://www.panda3d.org/license.txt . +// +// To contact the maintainers of this program write to +// panda3d@yahoogroups.com . +// +//////////////////////////////////////////////////////////////////// + +#include "mesaGraphicsPipe.h" +#include "mesaGraphicsBuffer.h" +#include "mesaGraphicsStateGuardian.h" +#include "config_mesadisplay.h" +#include "frameBufferProperties.h" +#include "mutexHolder.h" + +TypeHandle MesaGraphicsPipe::_type_handle; + +//////////////////////////////////////////////////////////////////// +// Function: MesaGraphicsPipe::Constructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +MesaGraphicsPipe:: +MesaGraphicsPipe() { + _supported_types = OT_buffer; + _is_valid = true; +} + +//////////////////////////////////////////////////////////////////// +// Function: MesaGraphicsPipe::Destructor +// Access: Public, Virtual +// Description: +//////////////////////////////////////////////////////////////////// +MesaGraphicsPipe:: +~MesaGraphicsPipe() { +} + +//////////////////////////////////////////////////////////////////// +// Function: MesaGraphicsPipe::get_interface_name +// Access: Published, Virtual +// Description: Returns the name of the rendering interface +// associated with this GraphicsPipe. This is used to +// present to the user to allow him/her to choose +// between several possible GraphicsPipes available on a +// particular platform, so the name should be meaningful +// and unique for a given platform. +//////////////////////////////////////////////////////////////////// +string MesaGraphicsPipe:: +get_interface_name() const { + return "Offscreen Mesa"; +} + +//////////////////////////////////////////////////////////////////// +// Function: MesaGraphicsPipe::pipe_constructor +// Access: Public, Static +// Description: This function is passed to the GraphicsPipeSelection +// object to allow the user to make a default +// MesaGraphicsPipe. +//////////////////////////////////////////////////////////////////// +PT(GraphicsPipe) MesaGraphicsPipe:: +pipe_constructor() { + return new MesaGraphicsPipe; +} + +//////////////////////////////////////////////////////////////////// +// Function: MesaGraphicsPipe::make_gsg +// Access: Protected, Virtual +// Description: Creates a new GSG to use the pipe (but no windows +// have been created yet for the GSG). This method will +// be called in the draw thread for the GSG. +//////////////////////////////////////////////////////////////////// +PT(GraphicsStateGuardian) MesaGraphicsPipe:: +make_gsg(const FrameBufferProperties &properties) { + return new MesaGraphicsStateGuardian(properties); +} + +//////////////////////////////////////////////////////////////////// +// Function: MesaGraphicsPipe::make_buffer +// Access: Protected, Virtual +// Description: Creates a new offscreen buffer on the pipe, if possible. +//////////////////////////////////////////////////////////////////// +PT(GraphicsBuffer) MesaGraphicsPipe:: +make_buffer(GraphicsStateGuardian *gsg, int x_size, int y_size, bool want_texture) { + return new MesaGraphicsBuffer(this, gsg, x_size, y_size, want_texture); +} diff --git a/panda/src/mesadisplay/mesaGraphicsPipe.h b/panda/src/mesadisplay/mesaGraphicsPipe.h new file mode 100644 index 0000000000..ad1991793f --- /dev/null +++ b/panda/src/mesadisplay/mesaGraphicsPipe.h @@ -0,0 +1,76 @@ +// Filename: mesaGraphicsPipe.h +// Created by: drose (09Feb04) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved +// +// All use of this software is subject to the terms of the Panda 3d +// Software license. You should have received a copy of this license +// along with this source code; you will also find a current copy of +// the license at http://www.panda3d.org/license.txt . +// +// To contact the maintainers of this program write to +// panda3d@yahoogroups.com . +// +//////////////////////////////////////////////////////////////////// + +#ifndef MESAGRAPHICSPIPE_H +#define MESAGRAPHICSPIPE_H + +#include "pandabase.h" +#include "graphicsWindow.h" +#include "graphicsPipe.h" + +#include + +class FrameBufferProperties; + +//////////////////////////////////////////////////////////////////// +// Class : MesaGraphicsPipe +// Description : This graphics pipe represents the interface for +// rendering with direct calls to the Mesa open-source +// software-only implementation of OpenGL. +// +// Raw Mesa supports only offscreen buffers, but it's +// possible to create and render into these offscreen +// buffers without having any X server or other +// operating system infrastructure in place. +//////////////////////////////////////////////////////////////////// +class MesaGraphicsPipe : public GraphicsPipe { +public: + MesaGraphicsPipe(); + virtual ~MesaGraphicsPipe(); + + virtual string get_interface_name() const; + static PT(GraphicsPipe) pipe_constructor(); + +protected: + virtual PT(GraphicsStateGuardian) make_gsg(const FrameBufferProperties &properties); + virtual PT(GraphicsBuffer) make_buffer(GraphicsStateGuardian *gsg, + int x_size, int y_size, bool want_texture); + +private: + +public: + static TypeHandle get_class_type() { + return _type_handle; + } + static void init_type() { + GraphicsPipe::init_type(); + register_type(_type_handle, "MesaGraphicsPipe", + GraphicsPipe::get_class_type()); + } + virtual TypeHandle get_type() const { + return get_class_type(); + } + virtual TypeHandle force_init_type() {init_type(); return get_class_type();} + +private: + static TypeHandle _type_handle; +}; + +#include "mesaGraphicsPipe.I" + +#endif diff --git a/panda/src/mesadisplay/mesaGraphicsStateGuardian.I b/panda/src/mesadisplay/mesaGraphicsStateGuardian.I new file mode 100644 index 0000000000..ccb78bb8e7 --- /dev/null +++ b/panda/src/mesadisplay/mesaGraphicsStateGuardian.I @@ -0,0 +1,17 @@ +// Filename: glxGraphicsStateGuardian.I +// Created by: drose (27Jan03) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved +// +// All use of this software is subject to the terms of the Panda 3d +// Software license. You should have received a copy of this license +// along with this source code; you will also find a current copy of +// the license at http://www.panda3d.org/license.txt . +// +// To contact the maintainers of this program write to +// panda3d@yahoogroups.com . +// +//////////////////////////////////////////////////////////////////// diff --git a/panda/src/mesadisplay/mesaGraphicsStateGuardian.cxx b/panda/src/mesadisplay/mesaGraphicsStateGuardian.cxx new file mode 100644 index 0000000000..348f16ffc1 --- /dev/null +++ b/panda/src/mesadisplay/mesaGraphicsStateGuardian.cxx @@ -0,0 +1,46 @@ +// Filename: mesaGraphicsStateGuardian.cxx +// Created by: drose (09Feb04) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved +// +// All use of this software is subject to the terms of the Panda 3d +// Software license. You should have received a copy of this license +// along with this source code; you will also find a current copy of +// the license at http://www.panda3d.org/license.txt . +// +// To contact the maintainers of this program write to +// panda3d@yahoogroups.com . +// +//////////////////////////////////////////////////////////////////// + +#include "mesaGraphicsStateGuardian.h" + +TypeHandle MesaGraphicsStateGuardian::_type_handle; + +//////////////////////////////////////////////////////////////////// +// Function: MesaGraphicsStateGuardian::Constructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +MesaGraphicsStateGuardian:: +MesaGraphicsStateGuardian(const FrameBufferProperties &properties) : + GLGraphicsStateGuardian(properties) +{ + _context = OSMesaCreateContext(OSMESA_RGBA, NULL); +} + +//////////////////////////////////////////////////////////////////// +// Function: MesaGraphicsStateGuardian::Destructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +MesaGraphicsStateGuardian:: +~MesaGraphicsStateGuardian() { + if (_context != (OSMesaContext)NULL) { + OSMesaDestroyContext(_context); + _context = (OSMesaContext)NULL; + } +} diff --git a/panda/src/mesadisplay/mesaGraphicsStateGuardian.h b/panda/src/mesadisplay/mesaGraphicsStateGuardian.h new file mode 100644 index 0000000000..ad9a17674a --- /dev/null +++ b/panda/src/mesadisplay/mesaGraphicsStateGuardian.h @@ -0,0 +1,59 @@ +// Filename: mesaGraphicsStateGuardian.h +// Created by: drose (09Feb04) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved +// +// All use of this software is subject to the terms of the Panda 3d +// Software license. You should have received a copy of this license +// along with this source code; you will also find a current copy of +// the license at http://www.panda3d.org/license.txt . +// +// To contact the maintainers of this program write to +// panda3d@yahoogroups.com . +// +//////////////////////////////////////////////////////////////////// + +#ifndef MESAGRAPHICSSTATEGUARDIAN_H +#define MESAGRAPHICSSTATEGUARDIAN_H + +#include "pandabase.h" + +#include "glGraphicsStateGuardian.h" +#include "mesaGraphicsPipe.h" + +//////////////////////////////////////////////////////////////////// +// Class : MesaGraphicsStateGuardian +// Description : A tiny specialization on GLGraphicsStateGuardian to +// add some Mesa-specific information. +//////////////////////////////////////////////////////////////////// +class MesaGraphicsStateGuardian : public GLGraphicsStateGuardian { +public: + MesaGraphicsStateGuardian(const FrameBufferProperties &properties); + virtual ~MesaGraphicsStateGuardian(); + + OSMesaContext _context; + +public: + static TypeHandle get_class_type() { + return _type_handle; + } + static void init_type() { + GLGraphicsStateGuardian::init_type(); + register_type(_type_handle, "MesaGraphicsStateGuardian", + GLGraphicsStateGuardian::get_class_type()); + } + virtual TypeHandle get_type() const { + return get_class_type(); + } + virtual TypeHandle force_init_type() {init_type(); return get_class_type();} + +private: + static TypeHandle _type_handle; +}; + +#include "mesaGraphicsStateGuardian.I" + +#endif