Panda3D
cocoaGraphicsBuffer.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file cocoaGraphicsBuffer.h
10  * @author rdb
11  * @date 2017-12-19
12  */
13 
14 #ifndef COCOAGRAPHICSBUFFER_H
15 #define COCOAGRAPHICSBUFFER_H
16 
17 #include "pandabase.h"
18 #include "glgsg.h"
19 
20 /**
21  * This is a light wrapper around GLGraphicsBuffer (ie. FBOs) to interface
22  * with Cocoa contexts, so that it can be used without a host window.
23  */
24 class CocoaGraphicsBuffer : public GLGraphicsBuffer {
25 public:
27  const std::string &name,
28  const FrameBufferProperties &fb_prop,
29  const WindowProperties &win_prop,
30  int flags,
32  GraphicsOutput *host);
33 
34  virtual bool begin_frame(FrameMode mode, Thread *current_thread);
35  virtual void end_frame(FrameMode mode, Thread *current_thread);
36 
37 protected:
38  virtual void close_buffer();
39  virtual bool open_buffer();
40 
41 public:
42  static TypeHandle get_class_type() {
43  return _type_handle;
44  }
45  static void init_type() {
46  GLGraphicsBuffer::init_type();
47  register_type(_type_handle, "CocoaGraphicsBuffer",
48  GLGraphicsBuffer::get_class_type());
49  }
50  virtual TypeHandle get_type() const {
51  return get_class_type();
52  }
53  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
54 
55 private:
56  static TypeHandle _type_handle;
57 };
58 
59 #include "cocoaGraphicsBuffer.I"
60 
61 #endif
This is a light wrapper around GLGraphicsBuffer (ie.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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:52
This is a base class for the various different classes that represent the result of a frame of render...
A thread; that is, a lightweight process.
Definition: thread.h:46
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:81
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...