Panda3D
|
00001 // Filename: eglGraphicsPixmap.h 00002 // Created by: pro-rsoft (13Jun09) 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 EGLGRAPHICSPIXMAP_H 00016 #define EGLGRAPHICSPIXMAP_H 00017 00018 #include "pandabase.h" 00019 00020 #include "eglGraphicsPipe.h" 00021 #include "graphicsBuffer.h" 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Class : eglGraphicsPixmap 00025 // Description : Another offscreen buffer in the EGL environment. This 00026 // creates a Pixmap object, which is probably less 00027 // efficient than an EGLPBuffer, so this class is a 00028 // second choice to eglGraphicsBuffer. 00029 //////////////////////////////////////////////////////////////////// 00030 class eglGraphicsPixmap : public GraphicsBuffer { 00031 public: 00032 eglGraphicsPixmap(GraphicsEngine *engine, GraphicsPipe *pipe, 00033 const string &name, 00034 const FrameBufferProperties &fb_prop, 00035 const WindowProperties &win_prop, 00036 int flags, 00037 GraphicsStateGuardian *gsg, 00038 GraphicsOutput *host); 00039 virtual ~eglGraphicsPixmap(); 00040 00041 virtual bool begin_frame(FrameMode mode, Thread *current_thread); 00042 virtual void end_frame(FrameMode mode, Thread *current_thread); 00043 00044 protected: 00045 virtual void close_buffer(); 00046 virtual bool open_buffer(); 00047 00048 private: 00049 X11_Display *_display; 00050 X11_Window _drawable; 00051 Pixmap _x_pixmap; 00052 EGLSurface _egl_surface; 00053 EGLDisplay _egl_display; 00054 00055 public: 00056 static TypeHandle get_class_type() { 00057 return _type_handle; 00058 } 00059 static void init_type() { 00060 GraphicsBuffer::init_type(); 00061 register_type(_type_handle, "eglGraphicsPixmap", 00062 GraphicsBuffer::get_class_type()); 00063 } 00064 virtual TypeHandle get_type() const { 00065 return get_class_type(); 00066 } 00067 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00068 00069 private: 00070 static TypeHandle _type_handle; 00071 }; 00072 00073 #endif