15 #ifndef GLXGRAPHICSSTATEGUARDIAN_H 16 #define GLXGRAPHICSSTATEGUARDIAN_H 18 #include "pandabase.h" 21 #include "glxGraphicsPipe.h" 22 #include "posixGraphicsStateGuardian.h" 24 #if defined(GLX_VERSION_1_4) 27 #define HAVE_GLXGETPROCADDRESS 1 29 #elif defined(GLX_ARB_get_proc_address) 31 #define HAVE_GLXGETPROCADDRESSARB 1 35 extern "C" void (*glXGetProcAddressARB(
const GLubyte *procName))( void );
41 #include "panda_glxext.h" 47 #ifndef GLX_SAMPLE_BUFFERS 48 #define GLX_SAMPLE_BUFFERS 100000 51 #define GLX_SAMPLES 100001 59 #ifndef __EDG__ // Protect the following from the Tau instrumentor. 60 typedef __GLXextFuncPtr (* PFNGLXGETPROCADDRESSPROC) (
const GLubyte *procName);
61 typedef int (* PFNGLXSWAPINTERVALSGIPROC) (
int interval);
63 typedef GLXFBConfig * (* PFNGLXCHOOSEFBCONFIGPROC) (X11_Display *dpy,
int screen,
const int *attrib_list,
int *nelements);
64 typedef GLXContext (* PFNGLXCREATENEWCONTEXTPROC) (X11_Display *dpy, GLXFBConfig config,
int render_type, GLXContext share_list, Bool direct);
65 typedef XVisualInfo * (* PFNGLXGETVISUALFROMFBCONFIGPROC) (X11_Display *dpy, GLXFBConfig config);
66 typedef int (* PFNGLXGETFBCONFIGATTRIBPROC) (X11_Display *dpy, GLXFBConfig config,
int attribute,
int *value);
67 typedef GLXPixmap (* PFNGLXCREATEPIXMAPPROC) (X11_Display *dpy, GLXFBConfig config, Pixmap pixmap,
const int *attrib_list);
68 typedef GLXPbuffer (* PFNGLXCREATEPBUFFERPROC) (X11_Display *dpy, GLXFBConfig config,
const int *attrib_list);
69 typedef void (* PFNGLXDESTROYPBUFFERPROC) (X11_Display *dpy, GLXPbuffer pbuf);
70 typedef GLXContext ( *PFNGLXCREATECONTEXTATTRIBSARBPROC) (X11_Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct,
const int *attrib_list);
83 bool &context_has_pbuffer,
bool &pixmap_supported,
84 bool &slow, GLXFBConfig config);
86 X11_Display *_display,
88 bool need_pbuffer,
bool need_pixmap);
97 GLXContext _share_context;
99 X11_Display *_display;
101 XVisualInfo *_visual;
102 XVisualInfo *_visuals;
104 GLXFBConfig _fbconfig;
106 bool _context_has_pbuffer;
107 bool _context_has_pixmap;
111 bool _supports_swap_control;
112 PFNGLXSWAPINTERVALSGIPROC _glXSwapIntervalSGI;
114 bool _supports_fbconfig;
115 PFNGLXCHOOSEFBCONFIGPROC _glXChooseFBConfig;
116 PFNGLXCREATENEWCONTEXTPROC _glXCreateNewContext;
117 PFNGLXGETVISUALFROMFBCONFIGPROC _glXGetVisualFromFBConfig;
118 PFNGLXGETFBCONFIGATTRIBPROC _glXGetFBConfigAttrib;
119 PFNGLXCREATEPIXMAPPROC _glXCreatePixmap;
120 PFNGLXCREATECONTEXTATTRIBSARBPROC _glXCreateContextAttribs;
122 bool _supports_pbuffer;
123 bool _uses_sgix_pbuffer;
124 PFNGLXCREATEPBUFFERPROC _glXCreatePbuffer;
125 PFNGLXCREATEGLXPBUFFERSGIXPROC _glXCreateGLXPbufferSGIX;
126 PFNGLXDESTROYPBUFFERPROC _glXDestroyPbuffer;
129 virtual void gl_flush()
const;
130 virtual GLenum gl_get_error()
const;
132 virtual void query_gl_version();
133 virtual void get_extra_extensions();
134 virtual void *do_get_extension_func(
const char *name);
137 void query_glx_extensions();
138 void show_glx_client_string(
const string &name,
int id);
139 void show_glx_server_string(
const string &name,
int id);
141 void init_temp_context();
142 void destroy_temp_xwindow();
144 int _glx_version_major, _glx_version_minor;
146 bool _checked_get_proc_address;
147 PFNGLXGETPROCADDRESSPROC _glXGetProcAddress;
149 GLXContext _temp_context;
150 X11_Window _temp_xwindow;
151 Colormap _temp_colormap;
157 static void init_type() {
158 PosixGraphicsStateGuardian::init_type();
159 register_type(_type_handle,
"glxGraphicsStateGuardian",
160 PosixGraphicsStateGuardian::get_class_type());
163 return get_class_type();
165 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
171 #include "glxGraphicsStateGuardian.I" A tiny specialization on GLGraphicsStateGuardian to add some glx-specific information.
void choose_pixel_format(const FrameBufferProperties &properties, X11_Display *_display, int _screen, bool need_pbuffer, bool need_pixmap)
Selects a visual or fbconfig for all the windows and buffers that use this gsg.
const FrameBufferProperties & get_fb_properties() const
Gets the FrameBufferProperties for all windows and buffers that use this GSG.
This GSG is used only for CallbackGraphicsWindow (which might not be using the glx interfaces)...
bool glx_is_at_least_version(int major_version, int minor_version) const
Returns true if the runtime GLX version number is at least the indicated value, false otherwise...
An object to create GraphicsOutputs that share a particular 3-D API.
void get_properties(FrameBufferProperties &properties, XVisualInfo *visual)
Gets the FrameBufferProperties to match the indicated visual.
void get_properties_advanced(FrameBufferProperties &properties, bool &context_has_pbuffer, bool &pixmap_supported, bool &slow, GLXFBConfig config)
Gets the FrameBufferProperties to match the indicated GLXFBConfig.
This class is the main interface to controlling the render process.
TypeHandle is the identifier used to differentiate C++ class types.
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...