Panda3D
|
00001 // Filename: glxGraphicsPipe.h 00002 // Created by: mike (09Jan97) 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 GLXGRAPHICSPIPE_H 00016 #define GLXGRAPHICSPIPE_H 00017 00018 #include "pandabase.h" 00019 #include "graphicsWindow.h" 00020 #include "graphicsPipe.h" 00021 #include "glgsg.h" 00022 #include "lightMutex.h" 00023 #include "lightReMutex.h" 00024 #include "x11GraphicsPipe.h" 00025 00026 class FrameBufferProperties; 00027 00028 #ifndef CPPPARSER 00029 00030 // Don't pick up the system glxext.h; use our own, which is better. 00031 #define __glxext_h_ 00032 00033 #include <GL/glx.h> 00034 00035 /* 00036 #if defined(GLX_VERSION_1_3) 00037 // If the system glx version is at least 1.3, then we know we have 00038 // GLXFBConfig and GLXPbuffer. 00039 #define HAVE_GLXFBCONFIG 00040 #define HAVE_OFFICIAL_GLXFBCONFIG 00041 #endif 00042 */ 00043 00044 // This must be included after we have included glgsg.h (which 00045 // includes gl.h), and after we have checked GLX_VERSION_1_3. But we 00046 // must also include it before we redefine the GLXFBConfig types, 00047 // below. 00048 #include "panda_glxext.h" 00049 00050 // drose: the version of GL/glx.h that ships with Fedora Core 2 seems 00051 // to define GLX_VERSION_1_4, but for some reason does not define 00052 // GLX_SAMPLE_BUFFERS or GLX_SAMPLES. We work around that here. 00053 00054 #ifndef GLX_SAMPLE_BUFFERS 00055 #define GLX_SAMPLE_BUFFERS 100000 00056 #endif 00057 #ifndef GLX_SAMPLES 00058 #define GLX_SAMPLES 100001 00059 #endif 00060 00061 00062 /* 00063 #if !defined(HAVE_GLXFBCONFIG) && defined(GLX_SGIX_fbconfig) && defined(GLX_SGIX_pbuffer) 00064 // If the system glx version isn't 1.3, but these were defined as 00065 // extensions, we can work with that. 00066 #define GLXFBConfig GLXFBConfigSGIX 00067 #define GLXPbuffer GLXPbufferSGIX 00068 #define glXChooseFBConfig glXChooseFBConfigSGIX 00069 #define glXCreateNewContext glXCreateContextWithConfigSGIX 00070 #define glXGetVisualFromFBConfig glXGetVisualFromFBConfigSGIX 00071 #define glXGetFBConfigAttrib glXGetFBConfigAttribSGIX 00072 #define glXDestroyPbuffer glXDestroyGLXPbufferSGIX 00073 00074 #define HAVE_GLXFBCONFIG 00075 #define HAVE_SGI_GLXFBCONFIG 00076 #endif 00077 */ 00078 00079 #endif // CPPPARSER 00080 00081 //////////////////////////////////////////////////////////////////// 00082 // Class : glxGraphicsPipe 00083 // Description : This graphics pipe represents the interface for 00084 // creating OpenGL graphics windows on an X-based 00085 // (e.g. Unix) client. 00086 //////////////////////////////////////////////////////////////////// 00087 class glxGraphicsPipe : public x11GraphicsPipe { 00088 public: 00089 glxGraphicsPipe(const string &display = string()); 00090 virtual ~glxGraphicsPipe() {}; 00091 00092 virtual string get_interface_name() const; 00093 static PT(GraphicsPipe) pipe_constructor(); 00094 00095 protected: 00096 virtual PT(GraphicsOutput) make_output(const string &name, 00097 const FrameBufferProperties &fb_prop, 00098 const WindowProperties &win_prop, 00099 int flags, 00100 GraphicsEngine *engine, 00101 GraphicsStateGuardian *gsg, 00102 GraphicsOutput *host, 00103 int retry, 00104 bool &precertify); 00105 00106 public: 00107 static TypeHandle get_class_type() { 00108 return _type_handle; 00109 } 00110 static void init_type() { 00111 x11GraphicsPipe::init_type(); 00112 register_type(_type_handle, "glxGraphicsPipe", 00113 x11GraphicsPipe::get_class_type()); 00114 } 00115 virtual TypeHandle get_type() const { 00116 return get_class_type(); 00117 } 00118 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00119 00120 private: 00121 static TypeHandle _type_handle; 00122 }; 00123 00124 #endif