Panda3D
tinyXGraphicsWindow.h
1 // Filename: tinyXGraphicsWindow.h
2 // Created by: drose (03May08)
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 TINYXGRAPHICSWINDOW_H
16 #define TINYXGRAPHICSWINDOW_H
17 
18 #include "pandabase.h"
19 
20 #ifdef HAVE_X11
21 
22 #include "tinyXGraphicsPipe.h"
23 #include "x11GraphicsWindow.h"
24 #include "buttonHandle.h"
25 
26 ////////////////////////////////////////////////////////////////////
27 // Class : TinyXGraphicsWindow
28 // Description : Opens a window on X11 to display the TinyPanda
29 // software rendering.
30 ////////////////////////////////////////////////////////////////////
31 class EXPCL_TINYDISPLAY TinyXGraphicsWindow : public x11GraphicsWindow {
32 public:
33  TinyXGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
34  const string &name,
35  const FrameBufferProperties &fb_prop,
36  const WindowProperties &win_prop,
37  int flags,
39  GraphicsOutput *host);
40  virtual ~TinyXGraphicsWindow();
41 
42  virtual bool begin_frame(FrameMode mode, Thread *current_thread);
43  virtual void end_frame(FrameMode mode, Thread *current_thread);
44  virtual void end_flip();
45  virtual bool supports_pixel_zoom() const;
46 
47  virtual void process_events();
48 
49 protected:
50  virtual void close_window();
51  virtual bool open_window();
52  virtual void pixel_factor_changed();
53 
54 private:
55  void create_full_frame_buffer();
56  void create_reduced_frame_buffer();
57  void create_ximage();
58 
59 private:
60  ZBuffer *_reduced_frame_buffer;
61  ZBuffer *_full_frame_buffer;
62  int _pitch;
63  XImage *_ximage;
64  GC _gc;
65  int _bytes_per_pixel;
66  Visual *_visual;
67  int _depth;
68 
69 public:
70  static TypeHandle get_class_type() {
71  return _type_handle;
72  }
73  static void init_type() {
74  x11GraphicsWindow::init_type();
75  register_type(_type_handle, "TinyXGraphicsWindow",
76  x11GraphicsWindow::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 "tinyXGraphicsWindow.I"
88 
89 #endif // HAVE_X11
90 
91 #endif
92 
virtual void end_flip()
This function will be called within the draw thread after begin_flip() has been called on all windows...
A container for the various kinds of properties we might ask to have on a graphics window before we o...
virtual bool supports_pixel_zoom() const
Returns true if a call to set_pixel_zoom() will be respected, false if it will be ignored...
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...
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...
virtual void process_events()
Do whatever processing is necessary to ensure that the window responds to user events.
Interfaces to the X11 window system.
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...