Panda3D

tinyXGraphicsWindow.h

00001 // Filename: tinyXGraphicsWindow.h
00002 // Created by:  drose (03May08)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef TINYXGRAPHICSWINDOW_H
00016 #define TINYXGRAPHICSWINDOW_H
00017 
00018 #include "pandabase.h"
00019 
00020 #ifdef HAVE_X11
00021 
00022 #include "tinyXGraphicsPipe.h"
00023 #include "x11GraphicsWindow.h"
00024 #include "buttonHandle.h"
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //       Class : TinyXGraphicsWindow
00028 // Description : Opens a window on X11 to display the TinyPanda
00029 //               software rendering.
00030 ////////////////////////////////////////////////////////////////////
00031 class EXPCL_TINYDISPLAY TinyXGraphicsWindow : public x11GraphicsWindow {
00032 public:
00033   TinyXGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, 
00034                       const string &name,
00035                       const FrameBufferProperties &fb_prop,
00036                       const WindowProperties &win_prop,
00037                       int flags,
00038                       GraphicsStateGuardian *gsg,
00039                       GraphicsOutput *host);
00040   virtual ~TinyXGraphicsWindow();
00041 
00042   virtual bool begin_frame(FrameMode mode, Thread *current_thread);
00043   virtual void end_frame(FrameMode mode, Thread *current_thread);
00044   virtual void end_flip();
00045   virtual bool supports_pixel_zoom() const;
00046 
00047   virtual void process_events();
00048 
00049 protected:
00050   virtual void close_window();
00051   virtual bool open_window();
00052   virtual void pixel_factor_changed();
00053 
00054 private:
00055   void create_full_frame_buffer();
00056   void create_reduced_frame_buffer();
00057   void create_ximage();
00058   
00059 private:
00060   ZBuffer *_reduced_frame_buffer;
00061   ZBuffer *_full_frame_buffer;
00062   int _pitch;
00063   XImage *_ximage;
00064   GC _gc;
00065   int _bytes_per_pixel;
00066   Visual *_visual;
00067   int _depth;
00068   
00069 public:
00070   static TypeHandle get_class_type() {
00071     return _type_handle;
00072   }
00073   static void init_type() {
00074     x11GraphicsWindow::init_type();
00075     register_type(_type_handle, "TinyXGraphicsWindow",
00076                   x11GraphicsWindow::get_class_type());
00077   }
00078   virtual TypeHandle get_type() const {
00079     return get_class_type();
00080   }
00081   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00082 
00083 private:
00084   static TypeHandle _type_handle;
00085 };
00086 
00087 #include "tinyXGraphicsWindow.I"
00088 
00089 #endif  // HAVE_X11
00090 
00091 #endif
00092 
 All Classes Functions Variables Enumerations