summaryrefslogtreecommitdiffstats
path: root/src/opengl/qgl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl/qgl.cpp')
-rw-r--r--src/opengl/qgl.cpp237
1 files changed, 0 insertions, 237 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 8ad9860..a0b2d3a 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -4851,243 +4851,6 @@ Q_OPENGL_EXPORT const QString qt_gl_library_name()
}
#endif
-#if 0
-void QGLDrawable::setDevice(QPaintDevice *pdev)
-{
- wasBound = false;
- widget = 0;
- buffer = 0;
- fbo = 0;
-#ifdef Q_WS_QWS
- wsurf = 0;
-#endif
-
-#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)
- if (pdev->devType() == QInternal::Pixmap) {
- QPixmapData *data = static_cast<QPixmap *>(pdev)->pixmapData();
- Q_ASSERT(data->classId() == QPixmapData::OpenGLClass);
- pixmapData = static_cast<QGLPixmapData *>(data);
-
- fbo = pixmapData->fbo();
- }
-#else
- Q_ASSERT(pdev->devType() != QInternal::Pixmap);
-#endif
-
- if (pdev->devType() == QInternal::Widget)
- widget = static_cast<QGLWidget *>(pdev);
- else if (pdev->devType() == QInternal::Pbuffer)
- buffer = static_cast<QGLPixelBuffer *>(pdev);
- else if (pdev->devType() == QInternal::FramebufferObject)
- fbo = static_cast<QGLFramebufferObject *>(pdev);
-#ifdef Q_WS_QWS
- else if (pdev->devType() == QInternal::UnknownDevice)
- wsurf = static_cast<QWSGLPaintDevice*>(pdev)->windowSurface();
-#elif !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)
- else if (pdev->devType() == QInternal::UnknownDevice)
- wsurf = static_cast<QGLWindowSurface *>(pdev);
-#endif
-}
-
-void QGLDrawable::swapBuffers()
-{
- if (widget) {
- if (widget->autoBufferSwap())
- widget->swapBuffers();
-#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)
- } else if (pixmapData) {
- pixmapData->swapBuffers();
-#endif
- } else {
- glFlush();
- }
-}
-
-void QGLDrawable::makeCurrent()
-{
- previous_fbo = 0;
-#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)
- if (!pixmapData && !fbo) {
-#else
- if (!fbo) {
-#endif
- QGLContext *ctx = context();
- previous_fbo = ctx->d_ptr->current_fbo;
- ctx->d_ptr->current_fbo = 0;
- if (previous_fbo)
- glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
- }
-
- if (widget)
- widget->makeCurrent();
-#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)
- else if (pixmapData)
- pixmapData->makeCurrent();
-#endif
- else if (buffer)
- buffer->makeCurrent();
-#if defined(Q_WS_QWS) || (!defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL))
- else if (wsurf)
- wsurf->context()->makeCurrent();
-#endif
- else if (fbo) {
- wasBound = fbo->isBound();
- if (!wasBound)
- fbo->bind();
- }
-}
-
-#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)
-QGLPixmapData *QGLDrawable::copyOnBegin() const
-{
- if (!pixmapData || pixmapData->isUninitialized())
- return 0;
- return pixmapData;
-}
-#endif
-
-void QGLDrawable::doneCurrent()
-{
-#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)
- if (pixmapData) {
- pixmapData->doneCurrent();
- return;
- }
-#endif
-
- if (previous_fbo) {
- QGLContext *ctx = context();
- ctx->d_ptr->current_fbo = previous_fbo;
- glBindFramebuffer(GL_FRAMEBUFFER_EXT, previous_fbo);
- }
-
- if (fbo && !wasBound)
- fbo->release();
-}
-
-QSize QGLDrawable::size() const
-{
- if (widget) {
- return QSize(widget->d_func()->glcx->device()->width(),
- widget->d_func()->glcx->device()->height());
-#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)
- } else if (pixmapData) {
- return pixmapData->size();
-#endif
- } else if (buffer) {
- return buffer->size();
- } else if (fbo) {
- return fbo->size();
- }
-#ifdef Q_WS_QWS
- else if (wsurf)
- return wsurf->window()->frameSize();
-#elif !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)
- else if (wsurf)
- return QSize(wsurf->width(), wsurf->height());
-#endif
- return QSize();
-}
-
-QGLFormat QGLDrawable::format() const
-{
- if (widget)
- return widget->format();
- else if (buffer)
- return buffer->format();
-#if defined(Q_WS_QWS) || (!defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL))
- else if (wsurf)
- return wsurf->context()->format();
-#endif
- else if (fbo && QGLContext::currentContext()) {
- QGLFormat fmt = QGLContext::currentContext()->format();
- fmt.setStencil(fbo->attachment() == QGLFramebufferObject::CombinedDepthStencil);
- fmt.setDepth(fbo->attachment() != QGLFramebufferObject::NoAttachment);
- return fmt;
- }
-
- return QGLFormat();
-}
-
-GLuint QGLDrawable::bindTexture(const QImage &image, GLenum target, GLint format,
- QGLContext::BindOptions options)
-{
- QGLTexture *texture = 0;
- options |= QGLContext::MemoryManagedBindOption;
- if (widget)
- texture = widget->d_func()->glcx->d_func()->bindTexture(image, target, format, options);
- else if (buffer)
- texture = buffer->d_func()->qctx->d_func()->bindTexture(image, target, format, options);
- else if (fbo && QGLContext::currentContext())
- texture = const_cast<QGLContext *>(QGLContext::currentContext())->d_func()->bindTexture(image, target, format, options);
-#if defined(Q_WS_QWS) || (!defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL))
- else if (wsurf)
- texture = wsurf->context()->d_func()->bindTexture(image, target, format, options);
-#endif
- return texture->id;
-}
-
-GLuint QGLDrawable::bindTexture(const QPixmap &pixmap, GLenum target, GLint format,
- QGLContext::BindOptions options)
-{
- QGLTexture *texture = 0;
- if (widget)
- texture = widget->d_func()->glcx->d_func()->bindTexture(pixmap, target, format, options);
- else if (buffer)
- texture = buffer->d_func()->qctx->d_func()->bindTexture(pixmap, target, format, options);
- else if (fbo && QGLContext::currentContext())
- texture = const_cast<QGLContext *>(QGLContext::currentContext())->d_func()->bindTexture(pixmap, target, format, options);
-#if defined(Q_WS_QWS) || (!defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL))
- else if (wsurf)
- texture = wsurf->context()->d_func()->bindTexture(pixmap, target, format, options);
-#endif
- return texture->id;
-}
-
-QColor QGLDrawable::backgroundColor() const
-{
- if (widget)
- return widget->palette().brush(widget->backgroundRole()).color();
-#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)
- else if (pixmapData)
- return pixmapData->fillColor();
-#endif
- return QApplication::palette().brush(QPalette::Background).color();
-}
-
-bool QGLDrawable::hasTransparentBackground() const
-{
- return widget && widget->testAttribute(Qt::WA_TranslucentBackground);
-}
-
-QGLContext *QGLDrawable::context() const
-{
- if (widget)
- return widget->d_func()->glcx;
- else if (buffer)
- return buffer->d_func()->qctx;
- else if (fbo)
- return const_cast<QGLContext *>(QGLContext::currentContext());
-#if defined(Q_WS_QWS) || (!defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL))
- else if (wsurf)
- return wsurf->context();
-#endif
- return 0;
-}
-
-bool QGLDrawable::autoFillBackground() const
-{
- if (widget)
- return widget->autoFillBackground();
-#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)
- else if (pixmapData)
- return pixmapData->needsFill();
-#endif
- else
- return false;
-}
-#endif
-
bool QGLShareRegister::checkSharing(const QGLContext *context1, const QGLContext *context2) {
bool sharing = (context1 && context2 && context1->d_ptr->group == context2->d_ptr->group);
return sharing;