OpenGL support and versions

149 views
Skip to first unread message

DrStroppy

unread,
Jan 3, 2012, 10:10:57 AM1/3/12
to android-qt
Hi,

I'm attempting to compile my OpenGL 1.0 based QT app with Necessitas.
However it complains about the OpenGL API's 'Not declared in this
scope', despite including <QtOpenGl> and adding QT += opengl in
the .pro file..

I notice that OpenGL support wasn't added until the Alpha 3 release.

The "updater" tells me there are no newer versions, I appear to have
necessitas version 2.3.11 and Qt 4.8.0-32, are these the versions that
support OpenGL?

If so, what do I need to do to support openGL?

Thanks!
Jon.

Tyler Mandry

unread,
Jan 7, 2012, 11:45:53 PM1/7/12
to andro...@googlegroups.com
In order to use OpenGL 1.x, you have to build Qt yourself. It's not optimal and it means you can't use the Ministro service, but it works for me. I'll assume you know what you're doing; you can find out info about git online and you definitely should have a look at https://sourceforge.net/p/necessitas/wiki/Compile%20Qt%20framework/ . I recommend checking out the alpha3 git branch; I'm not sure about the state of master.

Before you build, you have to change a couple of files:

1. In android/androidconfigbuild.sh go to the line where it has the configure options:
 $SRC_DIR_QT/configure -v -opensource -qpa ...
and add "-opengl es1" somewhere in there.

2. Next you need to make a change to the plugin code to change the major OpenGL version. Here is the diff:

======= Begin diff
diff --git a/src/plugins/platforms/android/src/opengl/qandroideglplatformcontext.cpp b/src/plugins/platforms/android/src/op
index 0a7b1f1..7906c73 100644
--- a/src/plugins/platforms/android/src/opengl/qandroideglplatformcontext.cpp
+++ b/src/plugins/platforms/android/src/opengl/qandroideglplatformcontext.cpp
@@ -44,7 +44,8 @@
 #include <QPlatformWindow>
 #include <QDebug>
 
-#include <GLES2/gl2.h>
+//#include <GLES2/gl2.h>
+#include <GLES/gl.h>
 #include <EGL/egl.h>
 #include "qeglconvenience.h"
 
@@ -63,7 +64,7 @@ QAndroidEglFSPlatformContext::QAndroidEglFSPlatformContext(EGLDisplay display, E
 
     EGLint attribList[3];
     attribList[0] = EGL_CONTEXT_CLIENT_VERSION;
-    attribList[1] = 2;
+    attribList[1] = 1;
     attribList[2] = EGL_NONE;
 ======= End diff

As far as changes go it's pretty straightforward. Best of luck.
--
Tyler Mandry
Reply all
Reply to author
Forward
0 new messages