src/opengl/qglpixelbuffer_egl.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
child 30 5dc02b23752f
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
     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 **
    62 bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidget *shareWidget)
    62 bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidget *shareWidget)
    63 {
    63 {
    64     // Create the EGL context.
    64     // Create the EGL context.
    65     ctx = new QEglContext();
    65     ctx = new QEglContext();
    66     ctx->setApi(QEgl::OpenGL);
    66     ctx->setApi(QEgl::OpenGL);
    67 
       
    68     // Open the EGL display.
       
    69     if (!ctx->openDisplay(0)) {
       
    70         delete ctx;
       
    71         ctx = 0;
       
    72         return false;
       
    73     }
       
    74 
    67 
    75     // Find the shared context.
    68     // Find the shared context.
    76     QEglContext *shareContext = 0;
    69     QEglContext *shareContext = 0;
    77     if (shareWidget && shareWidget->d_func()->glcx)
    70     if (shareWidget && shareWidget->d_func()->glcx)
    78         shareContext = shareWidget->d_func()->glcx->d_func()->eglContext;
    71         shareContext = shareWidget->d_func()->glcx->d_func()->eglContext;
   213 }
   206 }
   214 
   207 
   215 bool QGLPixelBuffer::hasOpenGLPbuffers()
   208 bool QGLPixelBuffer::hasOpenGLPbuffers()
   216 {
   209 {
   217     // See if we have at least 1 configuration that matches the default format.
   210     // See if we have at least 1 configuration that matches the default format.
   218     EGLDisplay dpy = QEglContext::defaultDisplay(0);
   211     EGLDisplay dpy = QEglContext::display();
   219     if (dpy == EGL_NO_DISPLAY)
   212     if (dpy == EGL_NO_DISPLAY)
   220         return false;
   213         return false;
   221     QEglProperties configProps;
   214     QEglProperties configProps;
   222     qt_egl_set_format(configProps, QInternal::Pbuffer, QGLFormat::defaultFormat());
   215     qt_egl_set_format(configProps, QInternal::Pbuffer, QGLFormat::defaultFormat());
   223     configProps.setRenderableType(QEgl::OpenGL);
   216     configProps.setRenderableType(QEgl::OpenGL);