Panda3D
cocoaGraphicsPipe.h
1 // Filename: cocoaGraphicsPipe.h
2 // Created by: rdb (14May12)
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 COCOAGRAPHICSPIPE_H
16 #define COCOAGRAPHICSPIPE_H
17 
18 #include "pandabase.h"
19 #include "graphicsWindow.h"
20 #include "graphicsPipe.h"
21 #include "lightMutex.h"
22 #include "lightReMutex.h"
23 
24 #ifdef __OBJC__
25 #import <AppKit/NSScreen.h>
26 #else
27 struct NSScreen;
28 #endif
29 #include <ApplicationServices/ApplicationServices.h>
30 
32 
33 ////////////////////////////////////////////////////////////////////
34 // Class : CocoaGraphicsPipe
35 // Description : This graphics pipe represents the interface for
36 // creating OpenGL graphics windows on a Cocoa-based
37 // (e.g. Mac OS X) client.
38 ////////////////////////////////////////////////////////////////////
40 public:
42  CocoaGraphicsPipe(CGDirectDisplayID display);
43  CocoaGraphicsPipe(NSScreen *screen);
44  virtual ~CocoaGraphicsPipe();
45 
46  INLINE CGDirectDisplayID get_display_id() const;
47  INLINE NSScreen *get_nsscreen() const;
48 
49  virtual string get_interface_name() const;
50  static PT(GraphicsPipe) pipe_constructor();
51 
52 public:
53  virtual PreferredWindowThread get_preferred_window_thread() const;
54 
55 protected:
56  virtual PT(GraphicsOutput) make_output(const string &name,
57  const FrameBufferProperties &fb_prop,
58  const WindowProperties &win_prop,
59  int flags,
60  GraphicsEngine *engine,
62  GraphicsOutput *host,
63  int retry,
64  bool &precertify);
65  virtual PT(GraphicsStateGuardian) make_callback_gsg(GraphicsEngine *engine);
66 
67 private:
68  void load_display_information();
69 
70  // _display and _screen refer to the same thing,
71  // NSScreen being the tiny Cocoa wrapper around the Quartz
72  // display ID. NSScreen isn't generally useful, but we need
73  // it when creating the window.
74  CGDirectDisplayID _display;
75  NSScreen *_screen;
76 
77  friend class CocoaGraphicsWindow;
78 
79 public:
80  static TypeHandle get_class_type() {
81  return _type_handle;
82  }
83  static void init_type() {
84  GraphicsPipe::init_type();
85  register_type(_type_handle, "CocoaGraphicsPipe",
86  GraphicsPipe::get_class_type());
87  }
88  virtual TypeHandle get_type() const {
89  return get_class_type();
90  }
91  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
92 
93 private:
94  static TypeHandle _type_handle;
95 };
96 
97 #include "cocoaGraphicsPipe.I"
98 
99 #endif
CGDirectDisplayID get_display_id() const
Returns the Quartz display ID associated with this graphics pipe.
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 represents the interface for creating OpenGL graphics windows on a Cocoa-based (e...
NSScreen * get_nsscreen() const
Returns the Cocoa NSScreen pointer associated with this graphics pipe.
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:85
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
An interface to the Cocoa system for managing OpenGL windows under Mac OS X.