Panda3D

tinyOffscreenGraphicsPipe.cxx

00001 // Filename: tinyOffscreenGraphicsPipe.cxx
00002 // Created by:  drose (09Feb09)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "pandabase.h"
00016 
00017 #include "tinyOffscreenGraphicsPipe.h"
00018 #include "tinyGraphicsStateGuardian.h"
00019 #include "tinyGraphicsBuffer.h"
00020 #include "config_tinydisplay.h"
00021 #include "frameBufferProperties.h"
00022 
00023 TypeHandle TinyOffscreenGraphicsPipe::_type_handle;
00024 
00025 ////////////////////////////////////////////////////////////////////
00026 //     Function: TinyOffscreenGraphicsPipe::Constructor
00027 //       Access: Public
00028 //  Description: 
00029 ////////////////////////////////////////////////////////////////////
00030 TinyOffscreenGraphicsPipe::
00031 TinyOffscreenGraphicsPipe() {
00032   _supported_types = OT_buffer | OT_texture_buffer;
00033   _is_valid = true;
00034 }
00035 
00036 ////////////////////////////////////////////////////////////////////
00037 //     Function: TinyOffscreenGraphicsPipe::Destructor
00038 //       Access: Public, Virtual
00039 //  Description: 
00040 ////////////////////////////////////////////////////////////////////
00041 TinyOffscreenGraphicsPipe::
00042 ~TinyOffscreenGraphicsPipe() {
00043 }
00044 
00045 ////////////////////////////////////////////////////////////////////
00046 //     Function: TinyOffscreenGraphicsPipe::get_interface_name
00047 //       Access: Published, Virtual
00048 //  Description: Returns the name of the rendering interface
00049 //               associated with this GraphicsPipe.  This is used to
00050 //               present to the user to allow him/her to choose
00051 //               between several possible GraphicsPipes available on a
00052 //               particular platform, so the name should be meaningful
00053 //               and unique for a given platform.
00054 ////////////////////////////////////////////////////////////////////
00055 string TinyOffscreenGraphicsPipe::
00056 get_interface_name() const {
00057   return "TinyPanda";
00058 }
00059 
00060 ////////////////////////////////////////////////////////////////////
00061 //     Function: TinyOffscreenGraphicsPipe::pipe_constructor
00062 //       Access: Public, Static
00063 //  Description: This function is passed to the GraphicsPipeSelection
00064 //               object to allow the user to make a default
00065 //               TinyOffscreenGraphicsPipe.
00066 ////////////////////////////////////////////////////////////////////
00067 PT(GraphicsPipe) TinyOffscreenGraphicsPipe::
00068 pipe_constructor() {
00069   return new TinyOffscreenGraphicsPipe;
00070 }
00071 
00072 ////////////////////////////////////////////////////////////////////
00073 //     Function: TinyOffscreenGraphicsPipe::make_output
00074 //       Access: Protected, Virtual
00075 //  Description: Creates a new window on the pipe, if possible.
00076 ////////////////////////////////////////////////////////////////////
00077 PT(GraphicsOutput) TinyOffscreenGraphicsPipe::
00078 make_output(const string &name,
00079             const FrameBufferProperties &fb_prop,
00080             const WindowProperties &win_prop,
00081             int flags,
00082             GraphicsEngine *engine,
00083             GraphicsStateGuardian *gsg,
00084             GraphicsOutput *host,
00085             int retry,
00086             bool &precertify) {
00087   // Only thing to try: a TinyGraphicsBuffer
00088 
00089   if (retry == 0) {
00090     if (((flags&BF_require_parasite)!=0)||
00091         ((flags&BF_require_window)!=0)) {
00092       return NULL;
00093     }
00094     return new TinyGraphicsBuffer(engine, this, name, fb_prop, win_prop, flags, gsg, host);
00095   }
00096   
00097   // Nothing else left to try.
00098   return NULL;
00099 }
 All Classes Functions Variables Enumerations