PDA

View Full Version : Qt over openGL ES 2.0 in Mac OS



gal
3rd August 2015, 07:31
Hi,
I have a cross platform mobile application that uses openGL ES 2.0.
I want to write a Qt platform that will run on Mac OS. In order to use openGL ES 2.0 on mac (instead of openGL), I'm using powerVR drivers. Now I'm not sure what to do with Qt.
Is it possible to use QOpenGLWidget or QOpenGLContext with QWinodw to create the context and then let the underlying cross platform software run openGL ES 2.0 commands? I tried this in several ways but it didn't seem to work.
Maybe instead I can use native EGL to create the context, and then somehow bind it to a Qt display widget?


I'm new to Qt and openGL and I searched and read in the forum and internet about this but I'm confused. Can someone advise on which direction I should go?
Thank you very much!
Gal

gal
3rd August 2015, 09:46
If I try the following code on MAC OS X, the QOpenGLContext::create() returns false. Is it because openGL ES is not compatible with mac os?
Is there a way to use native EGL to create openGL ES context on mac os (using powerVR) and then bind it with a Qt display widget?


QWindow *win = new QWindow();
win->setSurfaceType(QSurface::SurfaceType::OpenGLSurfac e);
QOpenGLContext* ctx = new QOpenGLContext;
QSurfaceFormat* fmt = new QSurfaceFormat;
fmt->setRenderableType(QSurfaceFormat::OpenGLES);
fmt->setMajorVersion(2);
fmt->setMinorVersion(0);
fmt->setRedBufferSize(5);
fmt->setGreenBufferSize(6);
fmt->setBlueBufferSize(5);
fmt->setAlphaBufferSize(0);
fmt->setDepthBufferSize(0);
ctx->setFormat(*fmt);
ctx->create();

***UPDATE: I read about QEGLNativeContext, which could be good to me since I know how to create context with EGL, Can anyone point me to how I can include this platform specific class in my program?

***UPDATE 2: I tried using QEGLNativeContext but I only get the message: QCocoaGLContext: Requires a QCocoaNativeContext

If anyone has a clue on how I can continue, it would be much appreciated.

Thanks again
Gal