Panda3D
wdxGraphicsWindow9.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 wdxGraphicsWindow9.h
10  * @author mike
11  * @date 1997-01-09
12  */
13 
14 #ifndef WDXGRAPHICSWINDOW9_H
15 #define WDXGRAPHICSWINDOW9_H
16 
17 #include "pandabase.h"
18 #include "winGraphicsWindow.h"
20 #include "wdxGraphicsPipe9.h"
21 
22 class wdxGraphicsPipe9;
23 
24 /**
25  * A single graphics window for rendering DirectX under Microsoft Windows.
26  */
27 class EXPCL_PANDADX wdxGraphicsWindow9 : public WinGraphicsWindow {
28 public:
30  const std::string &name,
31  const FrameBufferProperties &fb_prop,
32  const WindowProperties &win_prop,
33  int flags,
35  GraphicsOutput *host);
36  virtual ~wdxGraphicsWindow9();
37 
38  virtual bool begin_frame(FrameMode mode, Thread *current_thread);
39  virtual void end_frame(FrameMode mode, Thread *current_thread);
40  virtual void end_flip();
41 
42  virtual int verify_window_sizes(int numsizes, int *dimen);
43 
44 protected:
45  virtual void close_window();
46  virtual bool open_window();
47  virtual void reset_window(bool swapchain);
48 
49  virtual void fullscreen_restored(WindowProperties &properties);
50  virtual void handle_reshape();
51  virtual bool do_fullscreen_resize(int x_size, int y_size);
52 
53 private:
54  struct DXDeviceInfo {
55  UINT cardID;
56  char szDriver[MAX_DEVICE_IDENTIFIER_STRING];
57  char szDescription[MAX_DEVICE_IDENTIFIER_STRING];
58  GUID guidDeviceIdentifier;
59  DWORD VendorID, DeviceID;
60  LARGE_INTEGER _driver_version;
61  HMONITOR _monitor;
62  };
64 
65  bool create_screen_buffers_and_device(DXScreenData &display,
66  bool force_16bpp_zbuffer);
67 
68  bool choose_device();
69  bool consider_device(wdxGraphicsPipe9 *dxpipe, DXDeviceInfo *device_info);
70 
71  bool reset_device_resize_window(UINT new_xsize, UINT new_ysize);
72  void init_resized_window();
73  void make_current();
74  static int D3DFMT_to_DepthBits(D3DFORMAT fmt);
75  static bool is_badvidmem_card(D3DADAPTER_IDENTIFIER9 *pDevID);
76 
78  DXScreenData _wcontext;
79 
80  int _depth_buffer_bpp;
81  bool _awaiting_restore;
82 
83 public:
84  static TypeHandle get_class_type() {
85  return _type_handle;
86  }
87  static void init_type() {
88  WinGraphicsWindow::init_type();
89  register_type(_type_handle, "wdxGraphicsWindow9",
90  WinGraphicsWindow::get_class_type());
91  }
92  virtual TypeHandle get_type() const {
93  return get_class_type();
94  }
95  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
96 
97 private:
98  static TypeHandle _type_handle;
99  friend class wdxGraphicsPipe9;
100 };
101 
102 
103 #include "wdxGraphicsWindow9.I"
104 
105 #endif
A GraphicsStateGuardian for rendering into DirectX9 contexts.
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
This class is the main interface to controlling the render process.
This is a base class for the various different classes that represent the result of a frame of render...
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.
virtual void end_flip()
This function will be called within the draw thread after begin_flip() has been called on all windows...
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.
An object to create GraphicsOutputs that share a particular 3-D API.
Definition: graphicsPipe.h:52
Encapsulates all the communication with a particular instance of a given rendering backend.
virtual int verify_window_sizes(int numsizes, int *dimen)
Determines which of the indicated window sizes are supported by available hardware (e....
A thread; that is, a lightweight process.
Definition: thread.h:46
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
An abstract base class for glGraphicsWindow and dxGraphicsWindow (and, in general,...
A container for the various kinds of properties we might ask to have on a graphics window before we o...
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:42
This graphics pipe represents the interface for creating DirectX9 graphics windows.
A single graphics window for rendering DirectX under Microsoft Windows.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.