Panda3D
cocoaGraphicsPipe.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 cocoaGraphicsPipe.h
10  * @author rdb
11  * @date 2012-05-14
12  */
13 
14 #ifndef COCOAGRAPHICSPIPE_H
15 #define COCOAGRAPHICSPIPE_H
16 
17 #include "pandabase.h"
18 #include "graphicsWindow.h"
19 #include "graphicsPipe.h"
20 #include "lightMutex.h"
21 #include "lightReMutex.h"
22 
23 #ifdef __OBJC__
24 #import <AppKit/NSScreen.h>
25 #else
26 struct NSScreen;
27 #endif
28 #include <ApplicationServices/ApplicationServices.h>
29 
31 
32 /**
33  * This graphics pipe represents the interface for creating OpenGL graphics
34  * windows on a Cocoa-based (e.g. Mac OS X) client.
35  */
37 public:
38  CocoaGraphicsPipe(CGDirectDisplayID display = CGMainDisplayID());
39  virtual ~CocoaGraphicsPipe();
40 
41  INLINE CGDirectDisplayID get_display_id() const;
42 
43  virtual std::string get_interface_name() const;
44  static PT(GraphicsPipe) pipe_constructor();
45 
46 public:
47  virtual PreferredWindowThread get_preferred_window_thread() const;
48 
49 protected:
50  virtual PT(GraphicsOutput) make_output(const std::string &name,
51  const FrameBufferProperties &fb_prop,
52  const WindowProperties &win_prop,
53  int flags,
54  GraphicsEngine *engine,
56  GraphicsOutput *host,
57  int retry,
58  bool &precertify);
59  virtual PT(GraphicsStateGuardian) make_callback_gsg(GraphicsEngine *engine);
60 
61 private:
62  void load_display_information();
63 
64  // This is the Quartz display identifier.
65  CGDirectDisplayID _display;
66 
67  friend class CocoaGraphicsWindow;
68 
69 public:
70  static TypeHandle get_class_type() {
71  return _type_handle;
72  }
73  static void init_type() {
74  GraphicsPipe::init_type();
75  register_type(_type_handle, "CocoaGraphicsPipe",
76  GraphicsPipe::get_class_type());
77  }
78  virtual TypeHandle get_type() const {
79  return get_class_type();
80  }
81  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
82 
83 private:
84  static TypeHandle _type_handle;
85 };
86 
87 #include "cocoaGraphicsPipe.I"
88 
89 #endif
CGDirectDisplayID get_display_id() const
Returns the Quartz display ID associated with this graphics pipe.
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.
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...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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...
This graphics pipe represents the interface for creating OpenGL graphics windows on a Cocoa-based (e....
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Encapsulates all the communication with a particular instance of a given rendering backend.
virtual PreferredWindowThread get_preferred_window_thread() const
Returns an indication of the thread in which this GraphicsPipe requires its window processing to be p...
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...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
An interface to the Cocoa system for managing OpenGL windows under Mac OS X.