Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

QT fails to run on Simulator

I've built QT accordint to http://hecgeek.blogspot.com/2011/10/qt-for-blackberry-playbook.html with minor tweaks on Mac.

When I try to run HelloWorld on Simulator I get an error in console:

"QBB: failed to find EGL config, err=12288, numConfig=0"

Does anybody have an idea what the issue is?

Thanks...

Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: QT fails to run on Simulator

Can somebody confirm please which version (1 or 2) of OpenGL should be used on Simulator?

Thanks

Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: QT fails to run on Simulator

Looks like I am talking to myself but anyway probably this info will be helpful to anybody who runs into the same issue.

1. SImulator usese OpenGL version 1.

2. Fix configure-qsk:

--- configure-qsk.bak	2012-01-09 14:46:26.000000000 -0500
+++ configure-qsk	2012-01-07 14:53:50.000000000 -0500
@@ -70,7 +70,7 @@
 
 # Use GLES1 for simulator and GLES2 for device
 # TODO: Remove this when simulator supports GLES2
-if [ "CPU" == "x86" ]; then
+if [ $CPU == "x86" ]; then
   GL_VERSION="es1"
   echo "Using OpenGL ES 1.0"
 else

3. Provide correct library here:

--- ./mkspecs/common/qcc-base-qnx.conf.bak	2012-01-09 14:50:12.000000000 -0500
+++ mkspecs/common/qcc-base-qnx.conf	2012-01-07 14:58:13.000000000 -0500
@@ -23,7 +23,7 @@
 QMAKE_LIBS_NETWORK      = -lsocket
 
 # OpenGL libraries have a dependency on libEGL
-QMAKE_LIBS_OPENGL_ES1   = -lGLES_CM -lEGL
+QMAKE_LIBS_OPENGL_ES1   = -lGLESv1_CM -lEGL
 QMAKE_LIBS_OPENGL_ES2   = -lGLESv2 -lEGL

 

4. For some reason eglChooseConfig does not work on Simulator (and I can't troubleshoot as I do not have source code) so I had to patch qbbglcontext.cpp in the following way:

--- qbbglcontext.cpp.bak	2012-01-08 21:30:15.000000000 -0500
+++ qbbglcontext.cpp	2012-01-08 23:08:40.000000000 -0500
@@ -151,8 +151,8 @@
 #else
     EGLint renderableType = EGL_OPENGL_ES_BIT;
 #endif
-
     // get EGL config compatible with window
+/*
     EGLint numConfig;
     EGLint configAttrs[] = { EGL_BUFFER_SIZE,       32,
                              EGL_ALPHA_SIZE,        8,
@@ -166,7 +166,62 @@
     if (eglResult != EGL_TRUE || numConfig == 0) {
         qFatal("QBB: failed to find EGL config, err=%d, numConfig=%d", eglGetError(), numConfig);
     }
-
+ */
+//---------------------------------------------------------------
+    EGLConfig *egl_configs;
+    EGLint egl_num_configs;
+    EGLint val;
+    EGLint i;
+    eglResult = eglGetConfigs(sEglDisplay, NULL, 0, &egl_num_configs);
+    if (eglResult != EGL_TRUE)
+        qFatal("QBB: failed on eglGetConfigs() - 2");
+    if (egl_num_configs == 0)
+        qFatal("QBB: eglGetConfigs: could not find a configuration");
+    egl_configs = (EGLConfig *)malloc(egl_num_configs * sizeof(*egl_configs));
+    if (egl_configs == NULL)
+        qFatal("QBB: could not allocate memory for %d EGL configs", egl_num_configs);
+    eglResult = eglGetConfigs(sEglDisplay, egl_configs, egl_num_configs, &egl_num_configs);
+    if (eglResult != EGL_TRUE) {
+        qFatal("QBB: failed on eglGetConfigs() - 2");
+        free(egl_configs);
+    }
+    for (i = 0; i < egl_num_configs; i++) {
+    	eglGetConfigAttrib(sEglDisplay, egl_configs[i], EGL_BUFFER_SIZE, &val);
+        if (val < 32) {
+            continue;
+        }
+        eglGetConfigAttrib(sEglDisplay, egl_configs[i], EGL_ALPHA_SIZE, &val);
+        if (val < 8) {
+            continue;
+        }
+        eglGetConfigAttrib(sEglDisplay, egl_configs[i], EGL_RED_SIZE, &val);
+        if (val < 8) {
+            continue;
+        }
+        eglGetConfigAttrib(sEglDisplay, egl_configs[i], EGL_GREEN_SIZE, &val);
+        if (val < 8) {
+            continue;
+        }
+        eglGetConfigAttrib(sEglDisplay, egl_configs[i], EGL_BLUE_SIZE, &val);
+        if (val < 8) {
+            continue;
+        }
+        eglGetConfigAttrib(sEglDisplay, egl_configs[i], EGL_SURFACE_TYPE, &val);
+        if (val < EGL_WINDOW_BIT) {
+            continue;
+        }
+        eglGetConfigAttrib(sEglDisplay, egl_configs[i], EGL_RENDERABLE_TYPE, &val);
+        if (val < renderableType) {
+            continue;
+        }
+        sEglConfig = egl_configs[i];
+        break;
+    }
+    free(egl_configs);
+    if (sEglConfig == (EGLConfig)0) {
+        qFatal("QBB: could not find a matching configuration");
+    }
+//---------------------------------------------------------------
     // query/cache window format
     sWindowFormat = qt_qPlatformWindowFormatFromConfig(sEglDisplay, sEglConfig);
     sWindowFormat.setWindowApi(QPlatformWindowFormat::OpenGL);

 

5. Build and install QT library:

./configure-qsk x86
./make
./make install

 

... and now you can run QT apps on simulator -)

New Contributor
Posts: 8
Registered: ‎11-12-2011
My Device: playbook
My Carrier: none

Re: QT fails to run on Simulator

Are you able to start the QT app from the console?

 

I did try out QT on simulator and it failed.

http://supportforums.blackberry.com/t5/Native-SDK-for-BlackBerry-Tablet/Simple-QT-app-failing-on-sim...

 

The solution to my problem was posted on post 11 of the thread.

But by then i had managed to get my app working on the playbook directly.

 

Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: QT fails to run on Simulator

No, I've built only QT libraries in console (probably I misunderstand you, what do you mean by 'start the QT app from the console'?).

Then HelloWorld was built/deployed using IDE (Momentics).

The solution posted in message 11 of mentioned thread is already in GitHub repo, so I pulled everything with this solution already in place.