Panda3D
tinyOffscreenGraphicsPipe.cxx
1 // Filename: tinyOffscreenGraphicsPipe.cxx
2 // Created by: drose (09Feb09)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "pandabase.h"
16 
17 #include "tinyOffscreenGraphicsPipe.h"
18 #include "tinyGraphicsStateGuardian.h"
19 #include "tinyGraphicsBuffer.h"
20 #include "config_tinydisplay.h"
21 #include "frameBufferProperties.h"
22 
23 TypeHandle TinyOffscreenGraphicsPipe::_type_handle;
24 
25 ////////////////////////////////////////////////////////////////////
26 // Function: TinyOffscreenGraphicsPipe::Constructor
27 // Access: Public
28 // Description:
29 ////////////////////////////////////////////////////////////////////
30 TinyOffscreenGraphicsPipe::
31 TinyOffscreenGraphicsPipe() {
32  _supported_types = OT_buffer | OT_texture_buffer;
33  _is_valid = true;
34 }
35 
36 ////////////////////////////////////////////////////////////////////
37 // Function: TinyOffscreenGraphicsPipe::Destructor
38 // Access: Public, Virtual
39 // Description:
40 ////////////////////////////////////////////////////////////////////
41 TinyOffscreenGraphicsPipe::
42 ~TinyOffscreenGraphicsPipe() {
43 }
44 
45 ////////////////////////////////////////////////////////////////////
46 // Function: TinyOffscreenGraphicsPipe::get_interface_name
47 // Access: Published, Virtual
48 // Description: Returns the name of the rendering interface
49 // associated with this GraphicsPipe. This is used to
50 // present to the user to allow him/her to choose
51 // between several possible GraphicsPipes available on a
52 // particular platform, so the name should be meaningful
53 // and unique for a given platform.
54 ////////////////////////////////////////////////////////////////////
57  return "TinyPanda";
58 }
59 
60 ////////////////////////////////////////////////////////////////////
61 // Function: TinyOffscreenGraphicsPipe::pipe_constructor
62 // Access: Public, Static
63 // Description: This function is passed to the GraphicsPipeSelection
64 // object to allow the user to make a default
65 // TinyOffscreenGraphicsPipe.
66 ////////////////////////////////////////////////////////////////////
67 PT(GraphicsPipe) TinyOffscreenGraphicsPipe::
68 pipe_constructor() {
69  return new TinyOffscreenGraphicsPipe;
70 }
71 
72 ////////////////////////////////////////////////////////////////////
73 // Function: TinyOffscreenGraphicsPipe::make_output
74 // Access: Protected, Virtual
75 // Description: Creates a new window on the pipe, if possible.
76 ////////////////////////////////////////////////////////////////////
77 PT(GraphicsOutput) TinyOffscreenGraphicsPipe::
78 make_output(const string &name,
79  const FrameBufferProperties &fb_prop,
80  const WindowProperties &win_prop,
81  int flags,
82  GraphicsEngine *engine,
84  GraphicsOutput *host,
85  int retry,
86  bool &precertify) {
87  // Only thing to try: a TinyGraphicsBuffer
88 
89  if (retry == 0) {
90  if (((flags&BF_require_parasite)!=0)||
91  ((flags&BF_require_window)!=0)) {
92  return NULL;
93  }
94  return new TinyGraphicsBuffer(engine, this, name, fb_prop, win_prop, flags, gsg, host);
95  }
96 
97  // Nothing else left to try.
98  return NULL;
99 }
An offscreen graphics buffer.
A container for the various kinds of properties we might ask to have on a graphics window before we o...
An object to create GraphicsOutputs that share a particular 3-D API.
Definition: graphicsPipe.h:58
This is a base class for the various different classes that represent the result of a frame of render...
This graphics pipe creates offscreen buffers only, but is completely platform-independent.
Encapsulates all the communication with a particular instance of a given rendering backend...
virtual string get_interface_name() const
Returns the name of the rendering interface associated with this GraphicsPipe.
This class is the main interface to controlling the render process.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...