Easiest, fastest way to render UIImage/PNG using OpenGL on iPhone? -


I wrote an iPhone application that takes input from a user and updates the bitmap context based on input. After the update, it then updates the performance of a UIView. I am completing this by applying drawRect in a UIView subclass.

Currently I'm using Quartz 2D, seeing that many times are being updated several times per second, I've found that while the app performs well in the emulator, it is on the actual device Too slow (though useless) I would like to re-write the drawback to use OpenGL (as I have heard that it is going to perform more?) If you have other ideas, then all of me Ears are

I have browsed around the web for samples / tutorials that how PNG can be used simply by using OpenGL, but the highest requirement is the receipt. I will quickly get a PNG file Or I'm looking for a small and sweet sample to take UIM and then using it OpenGL (rendering inside a UIView? Does it also come out imaginatively also?) - To speed up image rendering, use an indicator current quartz API for a document

Before you decide to reply with RTFM response - please do not waste your time or your own. . I am not looking for a shortcut, I have no problem doing homework. I am just looking for a simple solution that meets my needs and who is working hard to come, I am sure Those who are well-versed in OpenGLL, it can be understood that in 5 minutes this code needs to be cranked. If you are, this will make my day :).

Any help, guidance, etc. is always appreciated. Thank you.

Create a bitmap context with memory that you have allocated yourself

  Zero * Data = Molok (width * height * 4); CGContextRef ctx = CGBitmapContextCreate (...);  

And assign whatever you want in that bitmap context. Make a texture with the next data

  Glitch Texture (1, and Takeff); GlobIndactations (GL_Edit DD, Techfairf); GlTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_ UNSIGNED_BYTE, data);  

Now follow any tutorial to represent this texture with GL, using Apple's example code on how to render a GL in a UIView. Be careful that you use an RGBA byte command in the bitmap context (or swap the GL call to ARGB) Also, remember that GL only prefers texture with dimensions 2 ^ nx2 ^ n.

With the shared memory architecture of the iPhone, data is not being sent to the graphics card in every cycle, so it is more performance penalties.


Comments