Panda3D
tinyWinGraphicsPipe.cxx
1 // Filename: tinyWinGraphicsPipe.cxx
2 // Created by: drose (06May08)
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 #ifdef WIN32
18 
19 #include "tinyWinGraphicsPipe.h"
20 #include "config_tinydisplay.h"
21 #include "config_windisplay.h"
22 #include "tinyWinGraphicsWindow.h"
23 #include "tinyGraphicsBuffer.h"
24 
25 TypeHandle TinyWinGraphicsPipe::_type_handle;
26 
27 ////////////////////////////////////////////////////////////////////
28 // Function: TinyWinGraphicsPipe::Constructor
29 // Access: Public
30 // Description:
31 ////////////////////////////////////////////////////////////////////
32 TinyWinGraphicsPipe::
33 TinyWinGraphicsPipe() {
34 }
35 
36 ////////////////////////////////////////////////////////////////////
37 // Function: TinyWinGraphicsPipe::Destructor
38 // Access: Public, Virtual
39 // Description:
40 ////////////////////////////////////////////////////////////////////
41 TinyWinGraphicsPipe::
42 ~TinyWinGraphicsPipe() {
43 }
44 
45 ////////////////////////////////////////////////////////////////////
46 // Function: TinyWinGraphicsPipe::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 ////////////////////////////////////////////////////////////////////
55 string TinyWinGraphicsPipe::
56 get_interface_name() const {
57  return "TinyPanda";
58 }
59 
60 ////////////////////////////////////////////////////////////////////
61 // Function: TinyWinGraphicsPipe::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 // TinyWinGraphicsPipe.
66 ////////////////////////////////////////////////////////////////////
67 PT(GraphicsPipe) TinyWinGraphicsPipe::
68 pipe_constructor() {
69  return new TinyWinGraphicsPipe;
70 }
71 
72 ////////////////////////////////////////////////////////////////////
73 // Function: TinyWinGraphicsPipe::make_output
74 // Access: Protected, Virtual
75 // Description: Creates a new window or buffer on the pipe, if possible.
76 // This routine is only called from GraphicsEngine::make_output.
77 ////////////////////////////////////////////////////////////////////
78 PT(GraphicsOutput) TinyWinGraphicsPipe::
79 make_output(const string &name,
80  const FrameBufferProperties &fb_prop,
81  const WindowProperties &win_prop,
82  int flags,
83  GraphicsEngine *engine,
85  GraphicsOutput *host,
86  int retry,
87  bool &precertify) {
88 
89  if (!_is_valid) {
90  return NULL;
91  }
92 
93  TinyGraphicsStateGuardian *tinygsg = 0;
94  if (gsg != 0) {
95  DCAST_INTO_R(tinygsg, gsg, NULL);
96  }
97 
98  // First thing to try: a TinyWinGraphicsWindow
99 
100  if (retry == 0) {
101  if (((flags&BF_require_parasite)!=0)||
102  ((flags&BF_refuse_window)!=0)||
103  ((flags&BF_resizeable)!=0)||
104  ((flags&BF_size_track_host)!=0)||
105  ((flags&BF_rtt_cumulative)!=0)||
106  ((flags&BF_can_bind_color)!=0)||
107  ((flags&BF_can_bind_every)!=0)) {
108  return NULL;
109  }
110  if ((flags & BF_fb_props_optional)==0) {
111  if ((fb_prop.get_aux_rgba() > 0)||
112  (fb_prop.get_aux_hrgba() > 0)||
113  (fb_prop.get_aux_float() > 0)) {
114  return NULL;
115  }
116  }
117  return new TinyWinGraphicsWindow(engine, this, name, fb_prop, win_prop,
118  flags, gsg, host);
119  }
120 
121  // Second thing to try: a TinyGraphicsBuffer
122  if (retry == 1) {
123  if (((flags&BF_require_parasite)!=0)||
124  ((flags&BF_require_window)!=0)) {
125  return NULL;
126  }
127  return new TinyGraphicsBuffer(engine, this, name, fb_prop, win_prop,
128  flags, gsg, host);
129  }
130 
131  // Nothing else left to try.
132  return NULL;
133 }
134 
135 #endif // WIN32
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...
Encapsulates all the communication with a particular instance of a given rendering backend...
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...
An interface to the TinyPanda software rendering code within this module.