Panda3D
wglGraphicsWindow.h
1 // Filename: wglGraphicsWindow.h
2 // Created by: drose (20Dec02)
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 WGLGRAPHICSWINDOW_H
16 #define WGLGRAPHICSWINDOW_H
17 
18 #include "pandabase.h"
19 #include "winGraphicsWindow.h"
20 
21 ////////////////////////////////////////////////////////////////////
22 // Class : wglGraphicsWindow
23 // Description : A single graphics window for rendering OpenGL under
24 // Microsoft Windows.
25 ////////////////////////////////////////////////////////////////////
26 class EXPCL_PANDAGL wglGraphicsWindow : public WinGraphicsWindow {
27 public:
29  const string &name,
30  const FrameBufferProperties &fb_prop,
31  const WindowProperties &win_prop,
32  int flags,
34  GraphicsOutput *host);
35  virtual ~wglGraphicsWindow();
36 
37  virtual bool begin_frame(FrameMode mode, Thread *current_thread);
38  virtual void end_frame(FrameMode mode, Thread *current_thread);
39 
40  virtual void begin_flip();
41  virtual void ready_flip();
42  virtual void end_flip();
43 
44 protected:
45  virtual void close_window();
46  virtual bool open_window();
47 
48 private:
49  void setup_colormap(const PIXELFORMATDESCRIPTOR &pixelformat);
50 
51 #ifdef NOTIFY_DEBUG
52  static void print_pfd(PIXELFORMATDESCRIPTOR *pfd, char *msg);
53 #endif
54 
55  HDC _hdc;
56  HPALETTE _colormap;
57 
58 public:
59  static TypeHandle get_class_type() {
60  return _type_handle;
61  }
62  static void init_type() {
63  WinGraphicsWindow::init_type();
64  register_type(_type_handle, "wglGraphicsWindow",
65  WinGraphicsWindow::get_class_type());
66  }
67  virtual TypeHandle get_type() const {
68  return get_class_type();
69  }
70  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
71 
72 private:
73  static TypeHandle _type_handle;
74 };
75 
76 #include "wglGraphicsWindow.I"
77 
78 #endif
virtual void end_flip()
This function will be called within the draw thread after begin_flip() has been called on all windows...
virtual void begin_flip()
This function will be called within the draw thread after end_frame() has been called on all windows...
virtual void end_frame(FrameMode mode, Thread *current_thread)
This function will be called within the draw thread after rendering is completed for a given frame...
A container for the various kinds of properties we might ask to have on a graphics window before we o...
An abstract base class for glGraphicsWindow and dxGraphicsWindow (and, in general, graphics windows that interface with the Microsoft Windows API).
An object to create GraphicsOutputs that share a particular 3-D API.
Definition: graphicsPipe.h:58
A single graphics window for rendering OpenGL under Microsoft Windows.
This is a base class for the various different classes that represent the result of a frame of render...
virtual void ready_flip()
This function will be called within the draw thread after end_frame() has been called on all windows...
A thread; that is, a lightweight process.
Definition: thread.h:51
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...
virtual bool begin_frame(FrameMode mode, Thread *current_thread)
This function will be called within the draw thread before beginning rendering for a given frame...