src/opengl/qglpixelbuffer_x11.cpp File Reference

#include <qlibrary.h>
#include <qdebug.h>
#include <private/qgl_p.h>
#include <private/qt_x11_p.h>
#include <private/qpaintengine_opengl_p.h>
#include <qx11info_x11.h>
#include <GL/glx.h>
#include <qimage.h>
#include "qglpixelbuffer.h"
#include "qglpixelbuffer_p.h"

Include dependency graph for qglpixelbuffer_x11.cpp:

Go to the source code of this file.

Defines

#define GLX_RGBA_BIT   0x00000002
#define GLX_PBUFFER_BIT   0x00000004
#define GLX_DRAWABLE_TYPE   0x8010
#define GLX_RENDER_TYPE   0x8011
#define GLX_RGBA_TYPE   0x8014
#define GLX_PBUFFER_HEIGHT   0x8040
#define GLX_PBUFFER_WIDTH   0x8041
#define GLX_SAMPLE_BUFFERS_ARB   100000
#define GLX_SAMPLES_ARB   100001
#define glXChooseFBConfig   qt_glXChooseFBConfig
#define glXCreateNewContext   qt_glXCreateNewContext
#define glXCreatePbuffer   qt_glXCreatePbuffer
#define glXDestroyPbuffer   qt_glXDestroyPbuffer
#define glXGetFBConfigAttrib   qt_glXGetFBConfigAttrib
#define glXMakeContextCurrent   qt_glXMakeContextCurrent

Typedefs

typedef GLXFBConfig *(*) _glXChooseFBConfig (Display *dpy, int screen, const int *attrib_list, int *nelements)
typedef int(*) _glXGetFBConfigAttrib (Display *dpy, GLXFBConfig config, int attribute, int *value)
typedef GLXPbuffer(*) _glXCreatePbuffer (Display *dpy, GLXFBConfig config, const int *attrib_list)
typedef void(*) _glXDestroyPbuffer (Display *dpy, GLXPbuffer pbuf)
typedef GLXContext(*) _glXCreateNewContext (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct)
typedef Bool(*) _glXMakeContextCurrent (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx)

Functions

static bool qt_resolve_pbuffer_extensions ()
static void qt_format_to_attrib_list (const QGLFormat &f, int attribs[])

Variables

static _glXChooseFBConfig qt_glXChooseFBConfig = 0
static _glXCreateNewContext qt_glXCreateNewContext = 0
static _glXCreatePbuffer qt_glXCreatePbuffer = 0
static _glXDestroyPbuffer qt_glXDestroyPbuffer = 0
static _glXGetFBConfigAttrib qt_glXGetFBConfigAttrib = 0
static _glXMakeContextCurrent qt_glXMakeContextCurrent = 0


Define Documentation

#define GLX_DRAWABLE_TYPE   0x8010

Definition at line 39 of file qglpixelbuffer_x11.cpp.

Referenced by qt_format_to_attrib_list().

#define GLX_PBUFFER_BIT   0x00000004

Definition at line 38 of file qglpixelbuffer_x11.cpp.

Referenced by qt_format_to_attrib_list().

#define GLX_PBUFFER_HEIGHT   0x8040

Definition at line 42 of file qglpixelbuffer_x11.cpp.

Referenced by QGLPixelBuffer::hasOpenGLPbuffers(), and QGLPixelBufferPrivate::init().

#define GLX_PBUFFER_WIDTH   0x8041

Definition at line 43 of file qglpixelbuffer_x11.cpp.

Referenced by QGLPixelBuffer::hasOpenGLPbuffers(), and QGLPixelBufferPrivate::init().

#define GLX_RENDER_TYPE   0x8011

Definition at line 40 of file qglpixelbuffer_x11.cpp.

Referenced by qt_format_to_attrib_list().

#define GLX_RGBA_BIT   0x00000002

Definition at line 37 of file qglpixelbuffer_x11.cpp.

Referenced by qt_format_to_attrib_list().

#define GLX_RGBA_TYPE   0x8014

Definition at line 41 of file qglpixelbuffer_x11.cpp.

Referenced by QGLPixelBuffer::hasOpenGLPbuffers(), and QGLPixelBufferPrivate::init().

#define GLX_SAMPLE_BUFFERS_ARB   100000

Definition at line 47 of file qglpixelbuffer_x11.cpp.

#define GLX_SAMPLES_ARB   100001

Definition at line 48 of file qglpixelbuffer_x11.cpp.

#define glXChooseFBConfig   qt_glXChooseFBConfig

Definition at line 65 of file qglpixelbuffer_x11.cpp.

Referenced by QGLPixelBuffer::hasOpenGLPbuffers(), and QGLPixelBufferPrivate::init().

#define glXCreateNewContext   qt_glXCreateNewContext

Definition at line 66 of file qglpixelbuffer_x11.cpp.

Referenced by QGLPixelBuffer::hasOpenGLPbuffers(), and QGLPixelBufferPrivate::init().

#define glXCreatePbuffer   qt_glXCreatePbuffer

Definition at line 67 of file qglpixelbuffer_x11.cpp.

Referenced by QGLPixelBuffer::hasOpenGLPbuffers(), and QGLPixelBufferPrivate::init().

#define glXDestroyPbuffer   qt_glXDestroyPbuffer

Definition at line 68 of file qglpixelbuffer_x11.cpp.

Referenced by QGLPixelBufferPrivate::cleanup(), and QGLPixelBuffer::hasOpenGLPbuffers().

#define glXGetFBConfigAttrib   qt_glXGetFBConfigAttrib

Definition at line 69 of file qglpixelbuffer_x11.cpp.

Referenced by QGLPixelBufferPrivate::init().

#define glXMakeContextCurrent   qt_glXMakeContextCurrent

Definition at line 70 of file qglpixelbuffer_x11.cpp.

Referenced by QGLPixelBuffer::doneCurrent(), and QGLPixelBuffer::makeCurrent().


Typedef Documentation

typedef GLXFBConfig*(*) _glXChooseFBConfig(Display *dpy, int screen, const int *attrib_list, int *nelements)

Definition at line 51 of file qglpixelbuffer_x11.cpp.

typedef GLXContext(*) _glXCreateNewContext(Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct)

Definition at line 55 of file qglpixelbuffer_x11.cpp.

typedef GLXPbuffer(*) _glXCreatePbuffer(Display *dpy, GLXFBConfig config, const int *attrib_list)

Definition at line 53 of file qglpixelbuffer_x11.cpp.

typedef void(*) _glXDestroyPbuffer(Display *dpy, GLXPbuffer pbuf)

Definition at line 54 of file qglpixelbuffer_x11.cpp.

typedef int(*) _glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config, int attribute, int *value)

Definition at line 52 of file qglpixelbuffer_x11.cpp.

typedef Bool(*) _glXMakeContextCurrent(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx)

Definition at line 56 of file qglpixelbuffer_x11.cpp.


Function Documentation

static void qt_format_to_attrib_list ( const QGLFormat f,
int  attribs[] 
) [static]

Definition at line 92 of file qglpixelbuffer_x11.cpp.

References QGLFormat::accum(), QGLFormat::accumBufferSize(), QGLFormat::alpha(), QGLFormat::alphaBufferSize(), QGLFormat::blueBufferSize(), QGLFormat::depth(), QGLFormat::depthBufferSize(), QGLFormat::doubleBuffer(), GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT, GLX_RENDER_TYPE, GLX_RGBA_BIT, GLX_SAMPLE_BUFFERS_ARB, GLX_SAMPLES_ARB, QGLFormat::greenBufferSize(), i, QGLFormat::redBufferSize(), QGLFormat::sampleBuffers(), QGLFormat::samples(), QGLFormat::stencil(), QGLFormat::stencilBufferSize(), QGLFormat::stereo(), and XNone.

Referenced by QGLPixelBuffer::hasOpenGLPbuffers(), and QGLPixelBufferPrivate::init().

00093 {
00094     int i = 0;
00095     attribs[i++] = GLX_RENDER_TYPE;
00096     attribs[i++] = GLX_RGBA_BIT;
00097     attribs[i++] = GLX_DRAWABLE_TYPE;
00098     attribs[i++] = GLX_PBUFFER_BIT;
00099     attribs[i++] = GLX_RED_SIZE;
00100     attribs[i++] = f.redBufferSize() == -1 ? 1 : f.redBufferSize();
00101     attribs[i++] = GLX_GREEN_SIZE;
00102     attribs[i++] = f.greenBufferSize() == -1 ? 1 : f.greenBufferSize();
00103     attribs[i++] = GLX_BLUE_SIZE;
00104     attribs[i++] = f.blueBufferSize() == -1 ? 1 : f.blueBufferSize();
00105     if (f.doubleBuffer()) {
00106         attribs[i++] = GLX_DOUBLEBUFFER;
00107         attribs[i++] = true;
00108     }
00109     if (f.depth()) {
00110         attribs[i++] = GLX_DEPTH_SIZE;
00111         attribs[i++] = f.depthBufferSize() == -1 ? 1 : f.depthBufferSize();
00112     }
00113     if (f.stereo()) {
00114         attribs[i++] = GLX_STEREO;
00115         attribs[i++] = true;
00116     }
00117     if (f.stencil()) {
00118         attribs[i++] = GLX_STENCIL_SIZE;
00119         attribs[i++] = f.stencilBufferSize() == -1 ? 1 : f.stencilBufferSize();
00120     }
00121     if (f.alpha()) {
00122         attribs[i++] = GLX_ALPHA_SIZE;
00123         attribs[i++] = f.alphaBufferSize() == -1 ? 1 : f.alphaBufferSize();
00124     }
00125     if (f.accum()) {
00126         attribs[i++] = GLX_ACCUM_RED_SIZE;
00127         attribs[i++] = f.accumBufferSize() == -1 ? 1 : f.accumBufferSize();
00128         attribs[i++] = GLX_ACCUM_GREEN_SIZE;
00129         attribs[i++] = f.accumBufferSize() == -1 ? 1 : f.accumBufferSize();
00130         attribs[i++] = GLX_ACCUM_BLUE_SIZE;
00131         attribs[i++] = f.accumBufferSize() == -1 ? 1 : f.accumBufferSize();
00132         if (f.alpha()) {
00133             attribs[i++] = GLX_ACCUM_ALPHA_SIZE;
00134             attribs[i++] = f.accumBufferSize() == -1 ? 1 : f.accumBufferSize();
00135         }
00136     }
00137     if (f.sampleBuffers()) {
00138         attribs[i++] = GLX_SAMPLE_BUFFERS_ARB;
00139         attribs[i++] = 1;
00140         attribs[i++] = GLX_SAMPLES_ARB;
00141         attribs[i++] = f.samples() == -1 ? 4 : f.samples();
00142     }
00143 
00144     attribs[i] = XNone;
00145 }

Here is the call graph for this function:

static bool qt_resolve_pbuffer_extensions (  )  [static]

Definition at line 72 of file qglpixelbuffer_x11.cpp.

References qt_glXChooseFBConfig, qt_glXCreateNewContext, qt_glXCreatePbuffer, qt_glXDestroyPbuffer, qt_glXGetFBConfigAttrib, qt_glXMakeContextCurrent, and QLibrary::resolve().

Referenced by QGLPixelBuffer::hasOpenGLPbuffers(), and QGLPixelBufferPrivate::init().

00073 {
00074     static int resolved = false;
00075     if (resolved && qt_glXMakeContextCurrent)
00076         return true;
00077     else if (resolved)
00078         return false;
00079 
00080     QLibrary gl(QLatin1String("GL"));
00081     qt_glXChooseFBConfig = (_glXChooseFBConfig) gl.resolve("glXChooseFBConfig");
00082     qt_glXCreateNewContext = (_glXCreateNewContext) gl.resolve("glXCreateNewContext");
00083     qt_glXCreatePbuffer = (_glXCreatePbuffer) gl.resolve("glXCreatePbuffer");
00084     qt_glXDestroyPbuffer = (_glXDestroyPbuffer) gl.resolve("glXDestroyPbuffer");
00085     qt_glXGetFBConfigAttrib = (_glXGetFBConfigAttrib) gl.resolve("glXGetFBConfigAttrib");
00086     qt_glXMakeContextCurrent = (_glXMakeContextCurrent) gl.resolve("glXMakeContextCurrent");
00087 
00088     resolved = qt_glXMakeContextCurrent ? true : false;
00089     return resolved;
00090 }

Here is the call graph for this function:


Variable Documentation

_glXChooseFBConfig qt_glXChooseFBConfig = 0 [static]

Definition at line 58 of file qglpixelbuffer_x11.cpp.

Referenced by qt_resolve_pbuffer_extensions().

_glXCreateNewContext qt_glXCreateNewContext = 0 [static]

Definition at line 59 of file qglpixelbuffer_x11.cpp.

Referenced by qt_resolve_pbuffer_extensions().

_glXCreatePbuffer qt_glXCreatePbuffer = 0 [static]

Definition at line 60 of file qglpixelbuffer_x11.cpp.

Referenced by qt_resolve_pbuffer_extensions().

_glXDestroyPbuffer qt_glXDestroyPbuffer = 0 [static]

Definition at line 61 of file qglpixelbuffer_x11.cpp.

Referenced by qt_resolve_pbuffer_extensions().

_glXGetFBConfigAttrib qt_glXGetFBConfigAttrib = 0 [static]

Definition at line 62 of file qglpixelbuffer_x11.cpp.

Referenced by qt_resolve_pbuffer_extensions().

_glXMakeContextCurrent qt_glXMakeContextCurrent = 0 [static]

Definition at line 63 of file qglpixelbuffer_x11.cpp.

Referenced by qt_resolve_pbuffer_extensions().


Generated on Thu Mar 15 13:54:56 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1