76 \sa {opengl/pbuffers}{Pbuffers Example} |
76 \sa {opengl/pbuffers}{Pbuffers Example} |
77 */ |
77 */ |
78 |
78 |
79 #include <QtCore/qglobal.h> |
79 #include <QtCore/qglobal.h> |
80 |
80 |
81 #if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL) |
81 #if !defined(QT_OPENGL_ES_1) |
82 #include <private/qpaintengineex_opengl2_p.h> |
82 #include <private/qpaintengineex_opengl2_p.h> |
83 #endif |
83 #endif |
84 |
84 |
85 #include <qglpixelbuffer.h> |
85 #include <qglpixelbuffer.h> |
86 #include <private/qglpixelbuffer_p.h> |
86 #include <private/qglpixelbuffer_p.h> |
135 qctx->d_func()->paintDevice = q; |
135 qctx->d_func()->paintDevice = q; |
136 qctx->d_func()->valid = true; |
136 qctx->d_func()->valid = true; |
137 #if defined(Q_WS_WIN) && !defined(QT_OPENGL_ES) |
137 #if defined(Q_WS_WIN) && !defined(QT_OPENGL_ES) |
138 qctx->d_func()->dc = dc; |
138 qctx->d_func()->dc = dc; |
139 qctx->d_func()->rc = ctx; |
139 qctx->d_func()->rc = ctx; |
140 #elif (defined(Q_WS_X11) && !defined(QT_OPENGL_ES)) |
140 #elif (defined(Q_WS_X11) && defined(QT_NO_EGL)) |
141 qctx->d_func()->cx = ctx; |
141 qctx->d_func()->cx = ctx; |
142 qctx->d_func()->pbuf = (void *) pbuf; |
142 qctx->d_func()->pbuf = (void *) pbuf; |
143 qctx->d_func()->vi = 0; |
143 qctx->d_func()->vi = 0; |
144 #elif defined(Q_WS_MAC) |
144 #elif defined(Q_WS_MAC) |
145 qctx->d_func()->cx = ctx; |
145 qctx->d_func()->cx = ctx; |
146 qctx->d_func()->vi = 0; |
146 qctx->d_func()->vi = 0; |
147 #elif defined(QT_OPENGL_ES) |
147 #elif !defined(QT_NO_EGL) |
148 qctx->d_func()->eglContext = ctx; |
148 qctx->d_func()->eglContext = ctx; |
149 qctx->d_func()->eglSurface = pbuf; |
149 qctx->d_func()->eglSurface = pbuf; |
150 #endif |
150 #endif |
151 } |
151 } |
152 } |
152 } |
252 updateDynamicTexture(). |
252 updateDynamicTexture(). |
253 |
253 |
254 \sa size() |
254 \sa size() |
255 */ |
255 */ |
256 |
256 |
257 #if (defined(Q_WS_X11) || defined(Q_WS_WIN)) && !defined(QT_OPENGL_ES) |
257 #if (defined(Q_WS_X11) || defined(Q_WS_WIN)) && defined(QT_NO_EGL) |
258 GLuint QGLPixelBuffer::generateDynamicTexture() const |
258 GLuint QGLPixelBuffer::generateDynamicTexture() const |
259 { |
259 { |
260 Q_D(const QGLPixelBuffer); |
260 Q_D(const QGLPixelBuffer); |
261 GLuint texture; |
261 GLuint texture; |
262 glGenTextures(1, &texture); |
262 glGenTextures(1, &texture); |
385 { |
385 { |
386 Q_D(const QGLPixelBuffer); |
386 Q_D(const QGLPixelBuffer); |
387 return !d->invalid; |
387 return !d->invalid; |
388 } |
388 } |
389 |
389 |
390 #if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL) |
390 #if !defined(QT_OPENGL_ES_1) |
391 Q_GLOBAL_STATIC(QGL2PaintEngineEx, qt_buffer_2_engine) |
391 Q_GLOBAL_STATIC(QGL2PaintEngineEx, qt_buffer_2_engine) |
392 #endif |
392 #endif |
393 |
393 |
394 #ifndef QT_OPENGL_ES_2 |
394 #ifndef QT_OPENGL_ES_2 |
395 Q_GLOBAL_STATIC(QOpenGLPaintEngine, qt_buffer_engine) |
395 Q_GLOBAL_STATIC(QOpenGLPaintEngine, qt_buffer_engine) |
396 #endif |
396 #endif |
397 |
397 |
398 /*! \reimp */ |
398 /*! \reimp */ |
399 QPaintEngine *QGLPixelBuffer::paintEngine() const |
399 QPaintEngine *QGLPixelBuffer::paintEngine() const |
400 { |
400 { |
401 #if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_1_CL) |
401 #if defined(QT_OPENGL_ES_1) |
402 return qt_buffer_engine(); |
402 return qt_buffer_engine(); |
403 #elif defined(QT_OPENGL_ES_2) |
403 #elif defined(QT_OPENGL_ES_2) |
404 return qt_buffer_2_engine(); |
404 return qt_buffer_2_engine(); |
405 #else |
405 #else |
406 if (qt_gl_preferGL2Engine()) |
406 if (qt_gl_preferGL2Engine()) |