43 #include <private/qgl_p.h> 44 #include <private/qt_x11_p.h> 45 #include <private/qpaintengine_opengl_p.h> 54 #if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) 60 #ifndef GLX_VERSION_1_3 61 #define GLX_RGBA_BIT 0x00000002 62 #define GLX_PBUFFER_BIT 0x00000004 63 #define GLX_DRAWABLE_TYPE 0x8010 64 #define GLX_RENDER_TYPE 0x8011 65 #define GLX_RGBA_TYPE 0x8014 66 #define GLX_PBUFFER_HEIGHT 0x8040 67 #define GLX_PBUFFER_WIDTH 0x8041 70 #ifndef GLX_ARB_multisample 71 #define GLX_SAMPLE_BUFFERS_ARB 100000 72 #define GLX_SAMPLES_ARB 100001 75 typedef GLXFBConfig* (*_glXChooseFBConfig) (
Display *dpy,
int screen,
const int *attrib_list,
int *nelements);
89 #define glXChooseFBConfig qt_glXChooseFBConfig 90 #define glXCreateNewContext qt_glXCreateNewContext 91 #define glXCreatePbuffer qt_glXCreatePbuffer 92 #define glXDestroyPbuffer qt_glXDestroyPbuffer 93 #define glXGetFBConfigAttrib qt_glXGetFBConfigAttrib 94 #define glXMakeContextCurrent qt_glXMakeContextCurrent 100 static int resolved =
false;
124 attribs[i++] = GLX_RED_SIZE;
126 attribs[i++] = GLX_GREEN_SIZE;
128 attribs[i++] = GLX_BLUE_SIZE;
131 attribs[i++] = GLX_DOUBLEBUFFER;
135 attribs[i++] = GLX_DEPTH_SIZE;
139 attribs[i++] = GLX_STEREO;
143 attribs[i++] = GLX_STENCIL_SIZE;
147 attribs[i++] = GLX_ALPHA_SIZE;
151 attribs[i++] = GLX_ACCUM_RED_SIZE;
153 attribs[i++] = GLX_ACCUM_GREEN_SIZE;
155 attribs[i++] = GLX_ACCUM_BLUE_SIZE;
158 attribs[i++] = GLX_ACCUM_ALPHA_SIZE;
175 qWarning(
"QGLPixelBuffer: pbuffers are not supported on this system.");
184 int screen =
X11->defaultScreen;
189 if (configs && num_configs) {
194 format.setDoubleBuffer(res);
198 format.setDepthBufferSize(res);
202 format.setRedBufferSize(res);
204 format.setGreenBufferSize(res);
206 format.setBlueBufferSize(res);
210 format.setAlphaBufferSize(res);
214 format.setAccumBufferSize(res);
218 format.setStencilBufferSize(res);
222 format.setSampleBuffers(res);
223 if (
format.sampleBuffers()) {
229 GLXContext shareContext = 0;
230 if (shareWidget && shareWidget->d_func()->glcx)
231 shareContext = (GLXContext) shareWidget->d_func()->glcx->d_func()->cx;
238 qWarning(
"QGLPixelBuffer: Unable to create a pbuffer/context - giving up.");
243 qWarning(
"QGLPixelBuffer: Unable to find a context/format match - giving up.");
279 if (configs && num_configs) {
284 glXDestroyContext(
X11->display, ctx);
static void qt_format_to_attrib_list(const QGLFormat &f, int attribs[])
static _glXGetFBConfigAttrib qt_glXGetFBConfigAttrib
#define QT_END_NAMESPACE
This macro expands to.
#define glXGetFBConfigAttrib
static _glXDestroyPbuffer qt_glXDestroyPbuffer
GLXContext(* _glXCreateNewContext)(Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct)
static bool hasOpenGLPbuffers()
Returns true if the OpenGL pbuffer extension is present on this system; otherwise returns false...
static _glXChooseFBConfig qt_glXChooseFBConfig
#define glXChooseFBConfig
#define GLX_SAMPLE_BUFFERS_ARB
int width() const
Returns the width.
#define QT_BEGIN_NAMESPACE
This macro expands to.
#define GLX_PBUFFER_WIDTH
#define GLX_DRAWABLE_TYPE
static _glXCreateNewContext qt_glXCreateNewContext
static bool qt_resolve_pbuffer_extensions()
#define GLX_PBUFFER_HEIGHT
Q_CORE_EXPORT void qWarning(const char *,...)
GLXPbuffer(* _glXCreatePbuffer)(Display *dpy, GLXFBConfig config, const int *attrib_list)
#define glXDestroyPbuffer
static _glXCreatePbuffer qt_glXCreatePbuffer
bool bindToDynamicTexture(GLuint texture)
Generates and binds a 2D GL texture that is the same size as the pbuffer, and returns the texture's I...
void * qglx_getProcAddress(const char *procName)
Bool(* _glXMakeContextCurrent)(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx)
int height() const
Returns the height.
bool init(const QSize &size, const QGLFormat &f, QGLWidget *shareWidget)
GLXFBConfig *(* _glXChooseFBConfig)(Display *dpy, int screen, const int *attrib_list, int *nelements)
static _glXMakeContextCurrent qt_glXMakeContextCurrent
int(* _glXGetFBConfigAttrib)(Display *dpy, GLXFBConfig config, int attribute, int *value)
The QSize class defines the size of a two-dimensional object using integer point precision.
void releaseFromDynamicTexture()
Releases the pbuffer from any previously bound texture.
static Display * display()
Returns the default display for the application.
#define glXCreateNewContext
int screen() const
Returns the number of the screen currently in use.
void(* _glXDestroyPbuffer)(Display *dpy, GLXPbuffer pbuf)