How do we use textures in RGB565 w / iOS GLKTextureLoader format?

I am loading very large textures from JPG format, pre iOS5 I would use an Apple Texture2D sample to convert JPG texture to RGB565 from RGB888 to halve the required memory space. It will then be uploaded to the w / glTexImage2D GPU in RGB565 format.

With iOS5, I convert calls to use the new GLKTextureLoader. However, it seems that even if the JPGs do not have an alpha channel, it just uses RGB888 and therefore takes up twice as much memory in the GPU.

Is there a way to get GLKTextureLoader to use RGB565 when loading onto the GPU? I am using [GLKTextureLoader textureWithContentsOfFile: jpgFile] right now. I also tried [GLKTextureLoader textureWithContentsOfData: data] and gave it the NSData of the source RGB565 bitmap, but I get the error message "{GLKTextureLoaderErrorKey = image decoding failed}" when I try to do this.

+3
source share
1 answer

"textureWithContentsOfData" looks like a broken method (note: there is no documentation for it - there is no specification saying that it accepts) that Apple has not yet implemented - it fails for all the standard NSData inputs that I tried.

OpenGL, gl *, , GLKit.

Apple, , . GLTextureInfo ( , , ), , 5- !)


: Apple () "... . , ".

... : Apple : " , , . , "

( "" : PNG JPG PVR... ( PVR , ), .)

: OpenGL , GLKit, - OpenGL, .. , - , OpenGL TEN TIMES FASTER, Apple GLKit TextureInfo. - , : (.

+7

All Articles