configureAttributes.append(surfaceType);
configureAttributes.append(EGL_RENDERABLE_TYPE);
- configureAttributes.append(format.majorVersion() == 1 ? EGL_OPENGL_ES_BIT : EGL_OPENGL_ES2_BIT);
+ if (format.renderableType() == QSurfaceFormat::OpenVG)
+ configureAttributes.append(EGL_OPENVG_BIT);
+#ifdef EGL_VERSION_1_4
+ else if (format.renderableType() == QSurfaceFormat::OpenGL)
+ configureAttributes.append(EGL_OPENGL_BIT);
+#endif
+ else if (format.majorVersion() == 1)
+ configureAttributes.append(EGL_OPENGL_ES_BIT);
+ else
+ configureAttributes.append(EGL_OPENGL_ES2_BIT);
+
configureAttributes.append(EGL_NONE);
do {
return 0;
}
-QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config)
+QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config, const QSurfaceFormat &referenceFormat)
{
QSurfaceFormat format;
EGLint redSize = 0;
EGLint depthSize = 0;
EGLint stencilSize = 0;
EGLint sampleCount = 0;
+ EGLint renderableType = 0;
eglGetConfigAttrib(display, config, EGL_RED_SIZE, &redSize);
eglGetConfigAttrib(display, config, EGL_GREEN_SIZE, &greenSize);
eglGetConfigAttrib(display, config, EGL_DEPTH_SIZE, &depthSize);
eglGetConfigAttrib(display, config, EGL_STENCIL_SIZE, &stencilSize);
eglGetConfigAttrib(display, config, EGL_SAMPLES, &sampleCount);
+ eglGetConfigAttrib(display, config, EGL_RENDERABLE_TYPE, &renderableType);
+
+ if (referenceFormat.renderableType() == QSurfaceFormat::OpenVG && (renderableType & EGL_OPENVG_BIT))
+ format.setRenderableType(QSurfaceFormat::OpenVG);
+#ifdef EGL_VERSION_1_4
+ else if (referenceFormat.renderableType() == QSurfaceFormat::OpenGL && (renderableType & EGL_OPENGL_BIT))
+ format.setRenderableType(QSurfaceFormat::OpenGL);
+#endif
+ else
+ format.setRenderableType(QSurfaceFormat::OpenGLES);
format.setRedBufferSize(redSize);
format.setGreenBufferSize(greenSize);