Direct screen surface access for iPhone

Member
Posts: 51
Joined: 2009.02
Post: #1
I've been reading Zdziarski's iPhone Open Application Development. The problem I'm having is that I'm not using the Open Source toolchain he was using. I'm having trouble getting the example on page 100 (Core Surface example) working, which draws random snow on the screen.

Has anyone done something like this using XCode and Apple's official stuff?

I'm an experienced game programmer and designer (PC, Amiga, Sega, Xbox, PSP, PS2, Gamecube, Palm OS), but new to iPhone and this board. If I've missed a duplicate question, I apologize.
Quote this message in a reply
Member
Posts: 51
Joined: 2009.02
Post: #2
If that's an unanswerable question, then what is the simplest solution for double buffering on the iPhone, assuming I'm cool with writing into the frame buffer?

Or, what's the simplest solution for display for a 2D game?
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #3
I don't know if there's a "simplest" solution. We've all pretty much settled on using OpenGL for everything.
Quote this message in a reply
Moderator
Posts: 335
Joined: 2002.04
Post: #4
There's no direct frame buffer access. If you rely on non approved SDKs, you'll hit snags like that and code you get working on it isn't guaranteed to work on future versions of the hardware or OS.

As AnotherJake said, OpenGL is the way to go. It's pretty simple for 2D games and creating a new OpenGL ES project on XCode will give you a very straightforward example of doing double buffered 2D.
Quote this message in a reply
Member
Posts: 51
Joined: 2009.02
Post: #5
Thanks guys. So even for 2D games, OpenGL ES is the way to go.

Good to know.
Quote this message in a reply
Member
Posts: 715
Joined: 2003.04
Post: #6
Nosredna Wrote:If that's an unanswerable question


Not sure if its unaswerable, or if nobody saw the original post.
I check the board many times a day and yesterdays post just showed up when you posted today.

Sorry I can't answer it, you are way more experienced than I am.

An answer may come in time.

[edit]...yeah two posts while I typed this...and AnotherJake answered nine minutes into the future...
Quote this message in a reply
Member
Posts: 51
Joined: 2009.02
Post: #7
igame3d,

I wasn't being impatient. It just occurred to me after I posted my message that maybe I was asking the wrong question.

I'm picking up a couple more books and poring over the examples. This is always the hardest part for me. There's always a couple weeks of learning curve that are frustrating when you know how you'd do the game on other platforms.

I expect to learn a lot here. Yes, I have a lot of experience, and I'm glad to participate and give back to communities.

I have two blogs.

http://dreaminginjavascript.wordpress.com
http://alifeprogramming.wordpress.com

I started the latter one recently, and it'll end up having my stories about my life at COMPUTE! Magazine and at Dynamix, JTP, Sierra, and Pipeworks.
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #8
igame3d Wrote:[edit]...yeah two posts while I typed this...and AnotherJake answered nine minutes into the future...

Dude, very sorry about this. I approved the original post yesterday. I have no idea why it didn't show up for you until after the fact. Buggy forum software is what comes to mind.

It sucks that we have to approve the first few posts of new members, but I also wound up banning a user this morning for spamming -- which no one had to see Ninja ... So it's a trade-off.

Like for instance, you haven't seen this post yet:

Nosredna Wrote:Thanks guys. So even for 2D games, OpenGL ES is the way to go.

Yes, even for 2D OpenGL is the way to go for sure.



... now I go off to check the post queue again, which I do every time I visit, to make sure everyone who belongs here gets let in.
Quote this message in a reply
Member
Posts: 715
Joined: 2003.04
Post: #9
Nosredna Wrote:igame3d,

I wasn't being impatient.

I didn't think you were being impatient, I just didn't want you to think you were being ignored.
Quote this message in a reply
Member
Posts: 51
Joined: 2009.02
Post: #10
igame3d Wrote:I didn't think you were being impatient, I just didn't want you to think you were being ignored.

I appreciate it.

So how are people getting started on 2D games with OpenGL ES? I was going to use The GLSprite demo and go from there.
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #11
GLSprite will help you get started at the very beginning I suppose. Do you have any experience with OpenGL?
Quote this message in a reply
Member
Posts: 51
Joined: 2009.02
Post: #12
AnotherJake Wrote:GLSprite will help you get started at the very beginning I suppose. Do you have any experience with OpenGL?

Not much. But have worked quite a bit with 3D in games.

Are there good tutorials or samples for doing 2D in OpenGL? Just need a background and some sprites for my first game.
Quote this message in a reply
Moderator
Posts: 335
Joined: 2002.04
Post: #13
Nosredna Wrote:Not much. But have worked quite a bit with 3D in games.

Are there good tutorials or samples for doing 2D in OpenGL? Just need a background and some sprites for my first game.

Fire up XCode, select New Project and select the OpenGL ES iPhone project.

All it does is spin a flat 2D square in the middle of the screen using OpenGL, so it's pretty easy to disect. That + the nehe tutorials (which I believe someone here has been iPhoneifying) should sort you out.
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #14
Zwilnik Wrote:That + the nehe tutorials (which I believe someone here has been iPhoneifying) should sort you out.

This thread? I haven't read through any of it myself, but it seems like it might be helpful. I think I saw someone else mention a site regarding OpenGL games on iPhone but I can't recall.
Quote this message in a reply
Member
Posts: 39
Joined: 2008.09
Post: #15
The Crashlanding sample helped me greatly, too bad Apple removed it from SDK. It has a very handy Texture2d class to do some simple blits, you can easily find it in google.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  What is the fastest way to blit a framebuffer to the iPhone screen? Rasterman 20 28,636 Mar 2, 2011 08:26 AM
Last Post: arekkusu
  How do I get access to files that are created in the simulator? Toontingy 2 2,829 Apr 27, 2010 03:24 PM
Last Post: Toontingy
  How to access EAGLView/UIView functions from C? Rasterman 10 6,151 Apr 8, 2010 10:47 AM
Last Post: Rasterman
  Worms surface uripo 3 2,758 Jun 12, 2009 05:18 PM
Last Post: uripo
  Screenshot of iPhone screen Carlos Camacho 1 2,754 Jun 6, 2009 06:56 AM
Last Post: Najdorf