tinyOffscreenGraphicsPipe

This commit is contained in:
David Rose 2009-02-10 00:52:55 +00:00
parent f25605f398
commit 24caf70155
12 changed files with 213 additions and 16 deletions

View File

@ -637,7 +637,7 @@
#define X11_IPATH
#define X11_LPATH /usr/X11R6/lib
#define X11_LIBS X11
#defer HAVE_X11 $[libtest $[X11_LPATH],$[X11_LIBS]]
#defer HAVE_X11 $[and $[IS_LINUX],$[libtest $[X11_LPATH],$[X11_LIBS]]]
// How about GLX?
#define GLX_IPATH

View File

@ -126,6 +126,11 @@
//#else
//#print - Did not find SDL
//#endif
#if $[HAVE_X11]
#print + X11
#else
#print - Did not find X11
#endif
#if $[HAVE_MESA]
#print + Mesa
#else
@ -310,6 +315,9 @@ $[cdefine HAVE_TINYDISPLAY]
/* Define if we have the SDL library. */
$[cdefine HAVE_SDL]
/* Define if we have X11. */
$[cdefine HAVE_X11]
/* Define if we want to compile the threading code. */
$[cdefine HAVE_THREADS]

View File

@ -30,6 +30,7 @@
tinyWinGraphicsWindow.h tinyWinGraphicsWindow.I \
tinyXGraphicsPipe.I tinyXGraphicsPipe.h \
tinyXGraphicsWindow.h tinyXGraphicsWindow.I \
tinyOffscreenGraphicsPipe.I tinyOffscreenGraphicsPipe.h \
tinyOsxGraphicsPipe.I tinyOsxGraphicsPipe.h \
tinyOsxGraphicsWindow.h tinyOsxGraphicsWindow.I \
$[if $[IS_OSX],tinyOsxGraphicsWindow.mm,] \
@ -55,6 +56,7 @@
tinyGeomMunger.cxx \
tinyGraphicsBuffer.cxx \
tinyGraphicsStateGuardian.cxx \
tinyOffscreenGraphicsPipe.cxx \
tinyOsxGraphicsPipe.cxx \
tinySDLGraphicsPipe.cxx \
tinySDLGraphicsWindow.cxx \

View File

@ -21,6 +21,7 @@
#include "tinyOsxGraphicsWindow.h"
#include "tinySDLGraphicsPipe.h"
#include "tinySDLGraphicsWindow.h"
#include "tinyOffscreenGraphicsPipe.h"
#include "tinyGraphicsBuffer.h"
#include "tinyGraphicsStateGuardian.h"
#include "tinyGeomMunger.h"
@ -122,12 +123,12 @@ init_libtinydisplay() {
GraphicsPipeSelection *selection = GraphicsPipeSelection::get_global_ptr();
#ifdef IS_LINUX
#ifdef HAVE_X11
TinyXGraphicsPipe::init_type();
TinyXGraphicsWindow::init_type();
selection->add_pipe_type(TinyXGraphicsPipe::get_class_type(),
TinyXGraphicsPipe::pipe_constructor);
ps->set_system_tag("TinyPanda", "native_window_system", "X");
ps->set_system_tag("TinyPanda", "native_window_system", "X11");
#endif
#ifdef WIN32
@ -153,6 +154,11 @@ init_libtinydisplay() {
TinySDLGraphicsPipe::pipe_constructor);
ps->set_system_tag("TinyPanda", "SDL", "SDL");
#endif
TinyOffscreenGraphicsPipe::init_type();
selection->add_pipe_type(TinyOffscreenGraphicsPipe::get_class_type(),
TinyOffscreenGraphicsPipe::pipe_constructor);
ps->set_system_tag("TinyPanda", "", "");
}
////////////////////////////////////////////////////////////////////
@ -163,10 +169,6 @@ init_libtinydisplay() {
int
get_pipe_type_tinydisplay() {
#ifdef IS_LINUX
return TinyXGraphicsPipe::get_class_type().get_index();
#endif
#ifdef WIN32
return TinyWinGraphicsPipe::get_class_type().get_index();
#endif
@ -175,9 +177,13 @@ get_pipe_type_tinydisplay() {
return TinyOsxGraphicsPipe::get_class_type().get_index();
#endif
#ifdef HAVE_X11
return TinyXGraphicsPipe::get_class_type().get_index();
#endif
#ifdef HAVE_SDL
return TinySDLGraphicsPipe::get_class_type().get_index();
#endif
return 0;
return TinyOffscreenGraphicsPipe::get_class_type().get_index();
}

View File

@ -0,0 +1,14 @@
// Filename: tinyOffscreenGraphicsPipe.I
// Created by: drose (09Feb09)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,98 @@
// Filename: tinyOffscreenGraphicsPipe.cxx
// Created by: drose (09Feb09)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#include "pandabase.h"
#include "tinyOffscreenGraphicsPipe.h"
#include "tinyGraphicsStateGuardian.h"
#include "tinyGraphicsBuffer.h"
#include "config_tinydisplay.h"
#include "frameBufferProperties.h"
TypeHandle TinyOffscreenGraphicsPipe::_type_handle;
////////////////////////////////////////////////////////////////////
// Function: TinyOffscreenGraphicsPipe::Constructor
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
TinyOffscreenGraphicsPipe::
TinyOffscreenGraphicsPipe() {
_supported_types = OT_buffer | OT_texture_buffer;
_is_valid = true;
}
////////////////////////////////////////////////////////////////////
// Function: TinyOffscreenGraphicsPipe::Destructor
// Access: Public, Virtual
// Description:
////////////////////////////////////////////////////////////////////
TinyOffscreenGraphicsPipe::
~TinyOffscreenGraphicsPipe() {
}
////////////////////////////////////////////////////////////////////
// Function: TinyOffscreenGraphicsPipe::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 TinyOffscreenGraphicsPipe::
get_interface_name() const {
return "TinyPanda";
}
////////////////////////////////////////////////////////////////////
// Function: TinyOffscreenGraphicsPipe::pipe_constructor
// Access: Public, Static
// Description: This function is passed to the GraphicsPipeSelection
// object to allow the user to make a default
// TinyOffscreenGraphicsPipe.
////////////////////////////////////////////////////////////////////
PT(GraphicsPipe) TinyOffscreenGraphicsPipe::
pipe_constructor() {
return new TinyOffscreenGraphicsPipe;
}
////////////////////////////////////////////////////////////////////
// Function: TinyOffscreenGraphicsPipe::make_output
// Access: Protected, Virtual
// Description: Creates a new window on the pipe, if possible.
////////////////////////////////////////////////////////////////////
PT(GraphicsOutput) TinyOffscreenGraphicsPipe::
make_output(const string &name,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host,
int retry,
bool &precertify) {
// Only thing to try: a TinyGraphicsBuffer
if (retry == 0) {
if (((flags&BF_require_parasite)!=0)||
((flags&BF_require_window)!=0)) {
return NULL;
}
return new TinyGraphicsBuffer(this, name, fb_prop, win_prop, flags, gsg, host);
}
// Nothing else left to try.
return NULL;
}

View File

@ -0,0 +1,68 @@
// Filename: tinyOffscreenGraphicsPipe.h
// Created by: drose (09Feb09)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef TINYOFFSCREENGRAPHICSPIPE_H
#define TINYOFFSCREENGRAPHICSPIPE_H
#include "pandabase.h"
#include "graphicsWindow.h"
#include "graphicsPipe.h"
#include "tinyGraphicsStateGuardian.h"
class FrameBufferProperties;
////////////////////////////////////////////////////////////////////
// Class : TinyOffscreenGraphicsPipe
// Description : This graphics pipe creates offscreen buffers only,
// but is completely platform-independent.
////////////////////////////////////////////////////////////////////
class EXPCL_TINYDISPLAY TinyOffscreenGraphicsPipe : public GraphicsPipe {
public:
TinyOffscreenGraphicsPipe();
virtual ~TinyOffscreenGraphicsPipe();
virtual string get_interface_name() const;
static PT(GraphicsPipe) pipe_constructor();
protected:
virtual PT(GraphicsOutput) make_output(const string &name,
const FrameBufferProperties &fb_prop,
const WindowProperties &win_prop,
int flags,
GraphicsStateGuardian *gsg,
GraphicsOutput *host,
int retry,
bool &precertify);
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
GraphicsPipe::init_type();
register_type(_type_handle, "TinyOffscreenGraphicsPipe",
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 "tinyOffscreenGraphicsPipe.I"
#endif

View File

@ -13,7 +13,7 @@
////////////////////////////////////////////////////////////////////
#include "pandabase.h"
#ifdef IS_LINUX
#ifdef HAVE_X11
#include "tinyXGraphicsPipe.h"
#include "tinyXGraphicsWindow.h"
@ -341,4 +341,4 @@ io_error_handler(Display *display) {
return 0;
}
#endif // IS_LINUX
#endif // HAVE_X11

View File

@ -17,7 +17,7 @@
#include "pandabase.h"
#ifdef IS_LINUX
#ifdef HAVE_X11
#include "graphicsWindow.h"
#include "graphicsPipe.h"
@ -136,6 +136,6 @@ private:
#include "tinyXGraphicsPipe.I"
#endif // IS_LINUX
#endif // HAVE_X11
#endif

View File

@ -14,7 +14,7 @@
#include "pandabase.h"
#ifdef IS_LINUX
#ifdef HAVE_X11
#include "tinyXGraphicsWindow.h"
#include "tinyGraphicsStateGuardian.h"
@ -1643,5 +1643,5 @@ create_ximage() {
32, 0);
}
#endif // IS_LINUX
#endif // HAVE_X11

View File

@ -17,7 +17,7 @@
#include "pandabase.h"
#ifdef IS_LINUX
#ifdef HAVE_X11
#include "tinyXGraphicsPipe.h"
#include "graphicsWindow.h"
@ -127,7 +127,7 @@ private:
#include "tinyXGraphicsWindow.I"
#endif // IS_LINUX
#endif // HAVE_X11
#endif

View File

@ -4,6 +4,7 @@
#include "tinyOsxGraphicsPipe.h"
#include "tinyGraphicsStateGuardian.cxx"
#include "tinyOffscreenGraphicsPipe.cxx"
#include "tinyOsxGraphicsPipe.cxx"
#include "tinySDLGraphicsPipe.cxx"
#include "tinySDLGraphicsWindow.cxx"