Black screen of .. urm .. nothingness

A number of blog readers have mentioned the problem of getting nothing but a black screen when running the earlier tutorials under SDK 3.0. This is something which has been discussed in other blog entries, but I should have really done a blog post for it a while ago to save people digging around for the solution.

Basically, in the app delegate, the following like of code

[glView mainGameLoop];

Needs to be changed to the following line of code:

[glView performSelectorOnMainThread:@selector(mainGameLoop) withObject:nil waitUntilDone:NO];

The issue seems to be that the applicationDidFinishLaunching method is run on a thread other than the main queue, so our game loop needs to be run on the main thread and hence the command above works. I’m still not 100% certain of why this happened, but when I work it out or someone can tell me I’ll pass it on.

Hope that helps.

Mike

Share:
  • Digg
  • del.icio.us
  • Facebook
  • MySpace
  • Reddit
  • StumbleUpon
  • Technorati
  • TwitThis
  • Design Float
  • DZone
  • email
  • Google Bookmarks
  • LinkedIn
  • Scoopeo
  • Tumblr

2 Comments

Jason  on July 8th, 2009

Mike,

I’ve noticed something weird since I upgraded to 3.0, on the device(iphone 3gs) when using openGL, sometimes while the gameloop is running the fps will go down to like 30 (from 60). It happens fairly randomly and doesn’t happen with 2.2.1(ipod touch), also it doesnt happen on the device if it’s plugged in. Just curious if you’ve seen anything like this.

Thanks, and I love the tutorials.

Serdar  on September 30th, 2009

Mike, I’ve spent more than 8 hours looking for a solution for this. I did change my project similar to yours and it started not working. Then I downloaded your project and compared and commented my code. Everything was the same but my code did not run because my project target was 3.0. I think you should change the line in download project link too.

Leave a Comment