src/opengl/qglpixelbuffer_win.cpp
branchRCL_3
changeset 4 3b1da2848fc7
parent 0 1918ee327afb
equal deleted inserted replaced
3:41300fa6a67c 4:3b1da2848fc7
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the QtOpenGL module of the Qt Toolkit.
     7 ** This file is part of the QtOpenGL module of the Qt Toolkit.
     8 **
     8 **
   219         attribs[i++] = WGL_STENCIL_BITS_ARB;
   219         attribs[i++] = WGL_STENCIL_BITS_ARB;
   220         attribs[i++] = f.stencilBufferSize() == -1 ? 8 : f.stencilBufferSize();
   220         attribs[i++] = f.stencilBufferSize() == -1 ? 8 : f.stencilBufferSize();
   221     }
   221     }
   222     if ((f.redBufferSize() > 8 || f.greenBufferSize() > 8
   222     if ((f.redBufferSize() > 8 || f.greenBufferSize() > 8
   223          || f.blueBufferSize() > 8 || f.alphaBufferSize() > 8)
   223          || f.blueBufferSize() > 8 || f.alphaBufferSize() > 8)
   224         && (QGLExtensions::glExtensions & QGLExtensions::NVFloatBuffer))
   224         && (QGLExtensions::glExtensions() & QGLExtensions::NVFloatBuffer))
   225     {
   225     {
   226         attribs[i++] = WGL_FLOAT_COMPONENTS_NV;
   226         attribs[i++] = WGL_FLOAT_COMPONENTS_NV;
   227         attribs[i++] = TRUE;
   227         attribs[i++] = TRUE;
   228     }
   228     }
   229     // sample buffers doesn't work in conjunction with the render_texture extension
   229     // sample buffers doesn't work in conjunction with the render_texture extension
   366 }
   366 }
   367 
   367 
   368 bool QGLPixelBuffer::hasOpenGLPbuffers()
   368 bool QGLPixelBuffer::hasOpenGLPbuffers()
   369 {
   369 {
   370     bool ret = false;
   370     bool ret = false;
   371     QGLWidget *dmy = 0;
   371     QGLTemporaryContext *tmpContext = 0;
   372     if (!QGLContext::currentContext()) {
   372     if (!QGLContext::currentContext())
   373         dmy = new QGLWidget;
   373         tmpContext = new QGLTemporaryContext;
   374         dmy->makeCurrent();
       
   375     }
       
   376     PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB =
   374     PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB =
   377         (PFNWGLGETEXTENSIONSSTRINGARBPROC) wglGetProcAddress("wglGetExtensionsStringARB");
   375         (PFNWGLGETEXTENSIONSSTRINGARBPROC) wglGetProcAddress("wglGetExtensionsStringARB");
   378     if (wglGetExtensionsStringARB) {
   376     if (wglGetExtensionsStringARB) {
   379         QString extensions(QLatin1String(wglGetExtensionsStringARB(wglGetCurrentDC())));
   377         QString extensions(QLatin1String(wglGetExtensionsStringARB(wglGetCurrentDC())));
   380         if (extensions.contains(QLatin1String("WGL_ARB_pbuffer"))
   378         if (extensions.contains(QLatin1String("WGL_ARB_pbuffer"))
   381             && extensions.contains(QLatin1String("WGL_ARB_pixel_format"))) {
   379             && extensions.contains(QLatin1String("WGL_ARB_pixel_format"))) {
   382             ret = true;
   380             ret = true;
   383         }
   381         }
   384     }
   382     }
   385     if (dmy)
   383     if (tmpContext)
   386         delete dmy;
   384         delete tmpContext;
   387     return ret;
   385     return ret;
   388 }
   386 }
   389 
   387 
   390 QT_END_NAMESPACE
   388 QT_END_NAMESPACE