Android NDK samples native activity blank screen!!


I have a Samsung Galaxy S1. The samples most of the times start with blank screen.

I could potentially see the display if I do some cuddle touch like tinkering (AKA unknown pattern of touching). But this also does not work all the time. The task manager tells me its running, but when brought to focus the screen remains blank.

This happens with my application as well. And this seems to be display problem only…as I can print log output to see that my touch is work and my game is running !!

I have seen some posts (outside your forums) where similar problems exist but found no indicative answer.

Any hints atleast as to how to process, as this is outside the realm of my control !!

Also, has anyone observed similar problems while debugging or running ON DEVICE ???

Any help is greatly appreciated !!mkandula2012-05-07 04:01:58

The source of this bug is this…

width = PVRShellGet(prefWidth);

height = PVRShellGet(prefHeight);

In the android SDK these values returned are NOT THE SCREEN SIZES as (atleast) I would expect (as this works in the iOS pretty fine)

They are returning 0 or some extremely high valued number which has no correlation to the screen size.

I replace width and height manually and everything works fine !!

Can Img Tech verify this please ?


Madanmkandula2012-05-09 12:48:45

This isn't something we've seen. What version of Android is your device running? Also, when you mention samples, is this the SDK examples? If so, is it just a few or do all the PVRShell based examples show the same problem? What version of the SDK are you using?

Scott2012-05-14 10:25:31

My phone is running 2.3.3 samsung galaxy S1 (GT-I9000). kernel version Build number GINGERBREAD.DDJV9

The android NDK android-ndk-r7c with SDK_OGLES2_ANDROID_ARMV7_REL_2.10@863987

I have not tested all the samples, but I observed it in the skinning sample. Regardless, the debug values from my application confirm this problem for me !! 

Do note that this problem does not arise in windows emulation & iPhone OS. This arises only in the android.

mkandula2012-05-20 14:33:34

I'm afraid we're still not able to reproduce the issue you describe when using our Galaxy S and building the binary using the same NDK as you. Would it be possible for you to send your .apk to and we'll give that a try to see if it happens then.
Also, what DDK version is your phone running? This can be found from an adb shell by entering
cat /proc/pvr/version

Scott2012-05-23 10:06:52
Sorry for the delay..

I am emailing now 2 builds. One that uses the PVRShellGet/Set and the other that does not use this and simply hardcodes the width and height. You should get it from

This is the output I got
$ adb shell cat /proc/pvr/version
Version (release) smdkc110_android
System Version String: SGX540 S5PC110

Thanks for your files, they demonstrated the problem on our Galaxy S.
When you retrieve the width and height from the PVRShell are you doing this in InitApplication? Some of the PVRShell implementations retrieve the width and height from the egl window surface but at the time InitApplication is called the window surface hasn't been created. If this is the case, try rearranging your code so you are getting the width and height in InitView.
Though, this doesn't explain why the skinning example isn't working for you.


If I shift the code from InitApplication() to InitView(), the window in the emulator OS does not resize but it works on the device !
For kicks I tried to set a custom screen size on the device in InitView and it does work !
This implies that PVRShellSet does not work in InitView for the emulator OS as the window is created before it and thus works only in InitApplication as the window is not created by this point.
Could you please confirm if its something that ImgTec might consider as a bug or will I have to have create a workaround ?  

>skinning example isn't working for you
Please forgive, I think this sample does not exhibit this behavior and I could have got it mixed up with my debug theory.

mkandula2012-06-07 12:00:35

As a general rule, due to the order PVRShell performs its setup any of the PVRShellSets that affect the window/api initialisation should go in InitApplication and any PVRShellGets that rely on the window/api being initialised should go in InitView. e.g. To request a window of a certain width and height it should go in InitApplication and if you want to get the actual width and height you should query in InitView.

Thanks for the input Scott !!!

I fixed this in my code as suggested.