What is the fastest way to blit a framebuffer to the iPhone screen?

Member
Posts: 81
Joined: 2007.07
Post: #1
I will be porting my games which use my custom 2d engine, so I only require one blit to the screen per frame, I currently use glDrawPixels for my final blit on Mac and it works great. Is this what I should also use on the iPhone? Thank you for any help Smile
Quote this message in a reply
Member
Posts: 166
Joined: 2009.04
Post: #2
Rasterman Wrote:I will be porting my games which use my custom 2d engine, so I only require one blit to the screen per frame, I currently use glDrawPixels for my final blit on Mac and it works great. Is this what I should also use on the iPhone? Thank you for any help Smile

No such thing on the iPhone.

You gonna have to create a texture , updating it on every frame and rendering using screen sized quad.
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #3
I wouldn't use glDrawPixels on the Mac either. Texture uploading should be much faster using glTexSubImage2D. I haven't tried it on the iPhone, but I'd wager it's not very efficient.
Quote this message in a reply
Member
Posts: 81
Joined: 2007.07
Post: #4
For a 1280x800 screen on a MacBook glDrawPixels takes 6.5ms to update the screen including a glFlush, its plenty fast on everything I have tested it on. I don't remember if I tested glTexSubImage2D when I did the glDrawPixels, but looks like I might now as I will have to make a version that uses that for iPhone. Are there any non-opengl ways to screen blit quickly?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #5
Nope.













(These words are just making the message long enough to get past the forum censor)
Quote this message in a reply
Member
Posts: 81
Joined: 2007.07
Post: #6
Does anyone have any timing results on how fast, or slow I should say, it takes to do a full update with glTexSubImage2D or glTexImage2D? Any size texture is fine and I can extrapolate from there.

And what is the fastest texture format to upload in? Is it a 565 or 5551 format?
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #7
Rasterman Wrote:Does anyone have any timing results on how fast, or slow I should say, it takes to do a full update with glTexSubImage2D or glTexImage2D? Any size texture is fine and I can extrapolate from there.
Sorry I don't have any hard numbers for you, but glTexSubImage2D should be at least as fast and possibly faster than glTexImage2D because it shouldn't have to completely replace the storage, just modify it.

On the 565 vs 5551, for upload, I would imagine they'd be identical in terms of bandwidth because they're both 16 bits per pixel, so same amount of data needs to be shipped to graphics hardware.
Quote this message in a reply
Member
Posts: 81
Joined: 2007.07
Post: #8
I read on a blog that glTexSubImage2D is significantly slower because it has to recopy the texture somehow, but they didn't say using what format or how much slower. Also I would think getting the exact pixel format is crucial as otherwise it will have to do per-pixel conversions rather than just a memory copy?
Quote this message in a reply
Member
Posts: 166
Joined: 2009.04
Post: #9
Rasterman Wrote:I read on a blog that glTexSubImage2D is significantly slower because it has to recopy the texture somehow, but they didn't say using what format or how much slower. Also I would think getting the exact pixel format is crucial as otherwise it will have to do per-pixel conversions rather than just a memory copy?

Anytime you call glTexSubImage2D , the driver will swizzle whatever texture data you are submitting and there is no way to precook the data to avoid swizzling.
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #10
Rasterman Wrote:I read on a blog that glTexSubImage2D is significantly slower

[shrugs] I don't know. That is clearly in direct conflict of the information I've heard. It certainly would not be very hard to try both and measure.
Quote this message in a reply
Member
Posts: 81
Joined: 2007.07
Post: #11
warmi Wrote:Anytime you call glTexSubImage2D , the driver will swizzle whatever texture data you are submitting and there is no way to precook the data to avoid swizzling.

what do you mean by swizzle?
Quote this message in a reply
Member
Posts: 166
Joined: 2009.04
Post: #12
Rasterman Wrote:what do you mean by swizzle?

Convert it to its own internal format.
Quote this message in a reply
Member
Posts: 81
Joined: 2007.07
Post: #13
is that because you can't issue a 565 format texture via glTexSubImage2D? or why not if its the same format as the internal format?
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #14
Because your data isn't cache efficient for texture sampling.
Quote this message in a reply
Member
Posts: 81
Joined: 2007.07
Post: #15
ah, swizzle, i remember now, where you pack a cluster of (16x16 pixels for example) into a memory aligned row, since when you are rendering you are stepping through the texture at any angle. got it. but even when you call glTexImage2D, isn't the whole texture swizzled?
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Need help with pixel oriented framebuffer edepot 24 20,148 Mar 3, 2011 07:15 AM
Last Post: mariocaprino
  Fastest sprite method markhula 9 6,965 Sep 24, 2010 08:04 AM
Last Post: markhula
  Fastest Possible Blending Function, OpenGL ES 2.0 Macmenace 12 16,407 Apr 16, 2010 11:44 AM
Last Post: Macmenace
  rendering framebuffer texture not working lookitsash 2 4,091 Oct 30, 2009 09:49 AM
Last Post: arekkusu
  Screenshot of iPhone screen Carlos Camacho 1 2,714 Jun 6, 2009 06:56 AM
Last Post: Najdorf