Panda3D
graphicsBuffer.h
1 // Filename: graphicsBuffer.h
2 // Created by: drose (06Feb04)
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 #ifndef GRAPHICSBUFFER_H
16 #define GRAPHICSBUFFER_H
17 
18 #include "pandabase.h"
19 
20 #include "graphicsOutput.h"
21 #include "texture.h"
22 #include "pointerTo.h"
23 
24 ////////////////////////////////////////////////////////////////////
25 // Class : GraphicsBuffer
26 // Description : An offscreen buffer for rendering into. This is
27 // similar in function to a GraphicsWindow, except that
28 // the output is not visible to the user.
29 ////////////////////////////////////////////////////////////////////
30 class EXPCL_PANDA_DISPLAY GraphicsBuffer : public GraphicsOutput {
31 protected:
33  GraphicsPipe *pipe,
34  const string &name,
35  const FrameBufferProperties &fb_prop,
36  const WindowProperties &win_prop,
37  int flags,
39  GraphicsOutput *host);
40 
41 PUBLISHED:
42  virtual ~GraphicsBuffer();
43  virtual void set_size(int x, int y);
44 
45 public:
46  virtual void request_open();
47  virtual void request_close();
48 
49  // It is an error to call any of the following methods from any
50  // thread other than the window thread. These methods are normally
51  // called by the GraphicsEngine.
52  virtual void set_close_now();
53  virtual void process_events();
54 
55 protected:
56  virtual void close_buffer();
57  virtual bool open_buffer();
58 
59 protected:
60  enum OpenRequest {
61  OR_none,
62  OR_open,
63  OR_close,
64  };
65  OpenRequest _open_request;
66 
67 public:
68  static TypeHandle get_class_type() {
69  return _type_handle;
70  }
71  static void init_type() {
72  GraphicsOutput::init_type();
73  register_type(_type_handle, "GraphicsBuffer",
74  GraphicsOutput::get_class_type());
75  }
76  virtual TypeHandle get_type() const {
77  return get_class_type();
78  }
79  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
80 
81 private:
82  static TypeHandle _type_handle;
83 };
84 
85 #include "graphicsBuffer.I"
86 
87 #endif
virtual void request_close()
This is called by the GraphicsEngine to request that the window (or whatever) close itself or...
virtual void set_close_now()
This is called by the GraphicsEngine to insist that the output be closed immediately.
A container for the various kinds of properties we might ask to have on a graphics window before we o...
virtual void request_open()
This is called by the GraphicsEngine to request that the window (or whatever) open itself or...
An offscreen buffer for rendering into.
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...
virtual void process_events()
Do whatever processing in the window thread is appropriate for this output object each frame...
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...