#include <qglpixelbuffer_p.h>
Collaboration diagram for QGLPixelBufferPrivate:
Definition at line 110 of file qglpixelbuffer_p.h.
Public Member Functions | |
| QGLPixelBufferPrivate () | |
| bool | init (const QSize &size, const QGLFormat &f, QGLWidget *shareWidget) |
| void | common_init (const QSize &size, const QGLFormat &f, QGLWidget *shareWidget) |
| bool | cleanup () |
Public Attributes | |
| bool | invalid |
| QGLContext * | qctx |
| QGLPixelBuffer * | q_ptr |
| QGLFormat | format |
| QGLFormat | req_format |
| QPointer< QGLWidget > | req_shareWidget |
| QSize | req_size |
| QGLPixelBufferPrivate::QGLPixelBufferPrivate | ( | ) | [inline] |
Definition at line 113 of file qglpixelbuffer_p.h.
References QGLExtensions::init().
00113 : invalid(true), qctx(0), pbuf(0), ctx(0) 00114 { 00115 QGLExtensions::init(); 00116 #ifdef Q_WS_WIN 00117 dc = 0; 00118 #elif defined(Q_WS_MACX) 00119 share_ctx = 0; 00120 #endif 00121 }
Here is the call graph for this function:
| bool QGLPixelBufferPrivate::init | ( | const QSize & | size, | |
| const QGLFormat & | f, | |||
| QGLWidget * | shareWidget | |||
| ) |
Definition at line 148 of file qglpixelbuffer_x11.cpp.
References QX11Info::display(), GLX_PBUFFER_HEIGHT, GLX_PBUFFER_WIDTH, GLX_RGBA_TYPE, GLX_SAMPLE_BUFFERS_ARB, GLX_SAMPLES_ARB, glXChooseFBConfig, glXCreateNewContext, glXCreatePbuffer, glXGetFBConfigAttrib, qt_format_to_attrib_list(), qt_resolve_pbuffer_extensions(), qWarning(), size, X11, and XNone.
Referenced by common_init().
00149 { 00150 if (!qt_resolve_pbuffer_extensions()) { 00151 qWarning("QGLPixelBuffer: pbuffers are not supported on this system."); 00152 return false; 00153 } 00154 00155 int attribs[40]; 00156 int num_configs = 0; 00157 00158 qt_format_to_attrib_list(f, attribs); 00159 00160 GLXFBConfig *configs = glXChooseFBConfig(X11->display, X11->defaultScreen, attribs, &num_configs); 00161 if (configs && num_configs) { 00162 int res; 00163 glXGetFBConfigAttrib(X11->display, configs[0], GLX_LEVEL, &res); 00164 format.setPlane(res); 00165 glXGetFBConfigAttrib(X11->display, configs[0], GLX_DOUBLEBUFFER, &res); 00166 format.setDoubleBuffer(res); 00167 glXGetFBConfigAttrib(X11->display, configs[0], GLX_DEPTH_SIZE, &res); 00168 format.setDepth(res); 00169 if (format.depth()) 00170 format.setDepthBufferSize(res); 00171 glXGetFBConfigAttrib(X11->display, configs[0], GLX_RGBA, &res); 00172 format.setRgba(res); 00173 glXGetFBConfigAttrib(X11->display, configs[0], GLX_RED_SIZE, &res); 00174 format.setRedBufferSize(res); 00175 glXGetFBConfigAttrib(X11->display, configs[0], GLX_GREEN_SIZE, &res); 00176 format.setGreenBufferSize(res); 00177 glXGetFBConfigAttrib(X11->display, configs[0], GLX_BLUE_SIZE, &res); 00178 format.setBlueBufferSize(res); 00179 glXGetFBConfigAttrib(X11->display, configs[0], GLX_ALPHA_SIZE, &res); 00180 format.setAlpha(res); 00181 if (format.alpha()) 00182 format.setAlphaBufferSize(res); 00183 glXGetFBConfigAttrib(X11->display, configs[0], GLX_ACCUM_RED_SIZE, &res); 00184 format.setAccum(res); 00185 if (format.accum()) 00186 format.setAccumBufferSize(res); 00187 glXGetFBConfigAttrib(X11->display, configs[0], GLX_STENCIL_SIZE, &res); 00188 format.setStencil(res); 00189 if (format.stencil()) 00190 format.setStencilBufferSize(res); 00191 glXGetFBConfigAttrib(X11->display, configs[0], GLX_STEREO, &res); 00192 format.setStereo(res); 00193 glXGetFBConfigAttrib(X11->display, configs[0], GLX_SAMPLE_BUFFERS_ARB, &res); 00194 format.setSampleBuffers(res); 00195 if (format.sampleBuffers()) { 00196 glXGetFBConfigAttrib(X11->display, configs[0], GLX_SAMPLES_ARB, &res); 00197 format.setSamples(res); 00198 } 00199 00200 int pb_attribs[] = {GLX_PBUFFER_WIDTH, size.width(), GLX_PBUFFER_HEIGHT, size.height(), XNone}; 00201 GLXContext shareContext = 0; 00202 if (shareWidget && shareWidget->d_func()->glcx) 00203 shareContext = (GLXContext) shareWidget->d_func()->glcx->d_func()->cx; 00204 00205 pbuf = glXCreatePbuffer(QX11Info::display(), configs[0], pb_attribs); 00206 ctx = glXCreateNewContext(QX11Info::display(), configs[0], GLX_RGBA_TYPE, shareContext, true); 00207 00208 XFree(configs); 00209 if (!pbuf || !ctx) { 00210 qWarning("QGLPixelBuffer: Unable to create a pbuffer/context - giving up."); 00211 return false; 00212 } 00213 return true; 00214 } else { 00215 qWarning("QGLPixelBuffer: Unable to find a context/format match - giving up."); 00216 return false; 00217 } 00218 }
Here is the call graph for this function:
| void QGLPixelBufferPrivate::common_init | ( | const QSize & | size, | |
| const QGLFormat & | f, | |||
| QGLWidget * | shareWidget | |||
| ) |
Definition at line 67 of file qglpixelbuffer.cpp.
References format, init(), invalid, qctx, req_format, req_shareWidget, req_size, and size.
00068 { 00069 Q_Q(QGLPixelBuffer); 00070 if(init(size, format, shareWidget)) { 00071 req_size = size; 00072 req_format = format; 00073 req_shareWidget = shareWidget; 00074 invalid = false; 00075 qctx = new QGLContext(format); 00076 qctx->d_func()->sharing = (shareWidget != 0); 00077 qctx->d_func()->paintDevice = q; 00078 } 00079 }
Here is the call graph for this function:
| bool QGLPixelBufferPrivate::cleanup | ( | ) |
Definition at line 221 of file qglpixelbuffer_x11.cpp.
References QX11Info::display(), and glXDestroyPbuffer.
00222 { 00223 glXDestroyContext(QX11Info::display(), ctx); 00224 glXDestroyPbuffer(QX11Info::display(), pbuf); 00225 return true; 00226 }
Here is the call graph for this function:
Definition at line 128 of file qglpixelbuffer_p.h.
1.5.1