★ TouchArcade needs your help. Click here to support us on Patreon.

[iOS universal build] Black screen on iPad

11-06-2011, 01:23 PM
Joined: Nov 2011
Posts: 2
[iOS universal build] Black screen on iPad


I'm developing a simple game, and I'm getting a black screen on iPad.
It's running great on iPhone/iPod but on iPad it just shows a black screen and it does reponds to touch inputs and play sounds, which makes me think I'm doing something bad with the render.

I'm not using xib files, I'm building the view programmatically.

So, I wonder if someone has experienced the same, or has a clue of what I'm doing wrong.

Any help or tip would be really appreciated.
Thanks in advance!
11-06-2011, 01:39 PM
Joined: Dec 2010
Location: ΖΞN
Posts: 304
Unusual to see a tech question here! Makes a change though.

Does the pad have iOS 5? Compared to working devices. With the info provided we can only guess really, but a similar experience was due to linking shaders at the wrong time.
11-06-2011, 04:30 PM
Joined: May 2009
Location: UK
Posts: 741
Two things that have caused rendering problems for me in the last six months, they will almost certainly be of no use to you but illustrate the kind of things that can happen.

When iPad2 was first released, the curved planet surface in Topia was coming out flat. A single shader variable seemed to be doing nothing. I eventually realised that the problem was something like this in a shader:

mediump float curveFactor = 0.00005;

the precision of mediump is too low for this number to come out as anything but 0 BUT there is also a limitation of pre A5 hardware that 'mediump' in shaders is often unsupported and promoted to 'highp'. Basically, the only reason I was seeing a curve was an unsupported feature in the drivers on all pre-A5 hardware.

The night the iOS5 GM seed dropped I suddenly had no polygons reaching the the screen at all. After checking for GL_ERROR even more often than I had before I tracked it down to this call:

glUniformMatrix4fv(lParameter, 4*4, GL_FALSE, lMatrix);

I'd written it over a year earlier and it had never caused a problem but it turned out I had misread the docs, the '4*4' should have been '1'.

Obviously it's incredibly unlikely that either of these are related to your problem but it's possible that they illustrate the kind of problems you can get with GL.

I am now checking for GL_ERROR on every single GL call. Basically, for every call I use I have one of these:
#define V_glUniformMatrix4fv(location, count, transpose, value)																						glUniformMatrix4fv(location, count, transpose, value)																						GL_ERROR_ASSERT
In my debug build

GL_ERROR_ASSERT expands to nothing in the release build and checks for glGetError()==GL_NO_ERROR in debug.

Also, look into the new feature in Xcode4.2 that takes GL snapshots, I can't remeber what it's called but it looks a little like a camera in the debugger.

-=< Fat Owl With A Jetpack >=-
-=< Topia World Builder >=-
-=< Twitter >=-
-=< Blog >=-
11-06-2011, 07:07 PM
Joined: Nov 2011
Posts: 2
GlennX, you're right... while debugging it was giving me an assert (I've an assert on the main loop with glGetError just in case)... gotta investigate!

Thanks blitter, GlennX for the fast replies.
I'll report back when I find out what is going on.