14 #ifndef GLXGRAPHICSSTATEGUARDIAN_H
15 #define GLXGRAPHICSSTATEGUARDIAN_H
23 #if defined(GLX_VERSION_1_4)
26 #define HAVE_GLXGETPROCADDRESS 1
28 #elif defined(GLX_ARB_get_proc_address)
30 #define HAVE_GLXGETPROCADDRESSARB 1
34 extern "C" void (*glXGetProcAddressARB(
const GLubyte *procName))( void );
39 #include "panda_glxext.h"
45 #ifndef GLX_SAMPLE_BUFFERS
46 #define GLX_SAMPLE_BUFFERS 100000
49 #define GLX_SAMPLES 100001
56 #ifndef __EDG__ // Protect the following from the Tau instrumentor.
57 typedef __GLXextFuncPtr (* PFNGLXGETPROCADDRESSPROC) (
const GLubyte *procName);
58 typedef int (* PFNGLXSWAPINTERVALSGIPROC) (
int interval);
60 typedef GLXFBConfig * (* PFNGLXCHOOSEFBCONFIGPROC) (X11_Display *dpy,
int screen,
const int *attrib_list,
int *nelements);
61 typedef GLXContext (* PFNGLXCREATENEWCONTEXTPROC) (X11_Display *dpy, GLXFBConfig config,
int render_type, GLXContext share_list, Bool direct);
62 typedef XVisualInfo * (* PFNGLXGETVISUALFROMFBCONFIGPROC) (X11_Display *dpy, GLXFBConfig config);
63 typedef int (* PFNGLXGETFBCONFIGATTRIBPROC) (X11_Display *dpy, GLXFBConfig config,
int attribute,
int *value);
64 typedef GLXPixmap (* PFNGLXCREATEPIXMAPPROC) (X11_Display *dpy, GLXFBConfig config, Pixmap pixmap,
const int *attrib_list);
65 typedef GLXPbuffer (* PFNGLXCREATEPBUFFERPROC) (X11_Display *dpy, GLXFBConfig config,
const int *attrib_list);
66 typedef void (* PFNGLXDESTROYPBUFFERPROC) (X11_Display *dpy, GLXPbuffer pbuf);
67 typedef GLXContext ( *PFNGLXCREATECONTEXTATTRIBSARBPROC) (X11_Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct,
const int *attrib_list);
79 bool &context_has_pbuffer,
bool &pixmap_supported,
80 bool &slow, GLXFBConfig config);
82 X11_Display *_display,
84 bool need_pbuffer,
bool need_pixmap);
93 GLXContext _share_context;
95 X11_Display *_display;
98 XVisualInfo *_visuals;
100 GLXFBConfig _fbconfig;
102 bool _context_has_pbuffer;
103 bool _context_has_pixmap;
107 bool _supports_swap_control;
108 PFNGLXSWAPINTERVALSGIPROC _glXSwapIntervalSGI;
110 bool _supports_fbconfig;
111 PFNGLXCHOOSEFBCONFIGPROC _glXChooseFBConfig;
112 PFNGLXCREATENEWCONTEXTPROC _glXCreateNewContext;
113 PFNGLXGETVISUALFROMFBCONFIGPROC _glXGetVisualFromFBConfig;
114 PFNGLXGETFBCONFIGATTRIBPROC _glXGetFBConfigAttrib;
115 PFNGLXCREATEPIXMAPPROC _glXCreatePixmap;
116 PFNGLXCREATECONTEXTATTRIBSARBPROC _glXCreateContextAttribs;
118 bool _supports_pbuffer;
119 bool _uses_sgix_pbuffer;
120 PFNGLXCREATEPBUFFERPROC _glXCreatePbuffer;
121 PFNGLXCREATEGLXPBUFFERSGIXPROC _glXCreateGLXPbufferSGIX;
122 PFNGLXDESTROYPBUFFERPROC _glXDestroyPbuffer;
125 virtual void gl_flush()
const;
126 virtual GLenum gl_get_error()
const;
128 virtual void query_gl_version();
129 virtual void get_extra_extensions();
130 virtual void *do_get_extension_func(
const char *name);
133 void query_glx_extensions();
134 void show_glx_client_string(
const std::string &name,
int id);
135 void show_glx_server_string(
const std::string &name,
int id);
137 void init_temp_context();
138 void destroy_temp_xwindow();
140 int _glx_version_major, _glx_version_minor;
142 bool _checked_get_proc_address;
143 PFNGLXGETPROCADDRESSPROC _glXGetProcAddress;
145 GLXContext _temp_context;
146 X11_Window _temp_xwindow;
147 Colormap _temp_colormap;
153 static void init_type() {
154 PosixGraphicsStateGuardian::init_type();
156 PosixGraphicsStateGuardian::get_class_type());
159 return get_class_type();
161 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}