Qt on Android: Cube OpenGL ES 2.0 not working



  • Hi there,

    I'm working extensively on a Qt for Android project and already managed to try a lot of things on a Nexus 7 tablet running with Android 4.3 and supprting OpenGL ES 2.0.

    Currently I'm exploring the possibilities in Open GL and therefore I used the example "Cube OpenGL ES 2.0" which comes with the installation of the Qt framwork:
    ...\Qt\Qt5.1.1\5.1.1\mingw48_32\examples\opengl\cube

    While this example works on the Desktop envrionment, I just get a black screen on the Android tablet after successfull deployment. There is nor error in the build and deployment process and no error in the runtime log in QtCreator.

    After I changed the background color to red, I recognized that the cube is there and can be rotated by touch gestures but has just a black color.

    @qglClearColor(Qt::red);@

    This means that the texture "cube.png" is not rendered on the device. I tried using "cube.jpg" but this doesn't work too.

    Do I miss something?

    Is there a problem with textures in the current Qt for Android version?

    I managed to run another example using OpenGL ES 2.0 with shaders and triangles, but without textures.

    Does anyone have a hint for me or face the same experience?

    Regards Andreas



  • Are you familiar with adb logcat? If yes, maybe checkout if some error messages show up there.
    http://developer.android.com/tools/help/logcat.html



  • I checked the adb log file but could not recognize a failure regarding the topic.



  • I've faced the same issue when running the project for the iOS platform, and most likely the problem is the same, since it was OpenGL ES related.

    After a long search, I've found that the example cube problem was related with the texture dimensions not being power of two. So, in order to solve this, you need to set linear filtering and clamp to edge and disable mipmap.

    From the following link:
    http://stackoverflow.com/questions/11069441/non-power-of-two-textures-in-ios


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.