views:

33

answers:

1

How to load photo in apple official sample GLImageProcessing ?

I have succeed to load photo via UIImagePickerControllerDelegate, but in this sample, all image processing is based on OpenGL, which has its routine.

My purpose is to find out one solution to change the photo source, then I can use this sample to process different photos.

A: 

Still a bit of a beginner myself, but for what it's worth: Looking through the sample, I can see that in Imaging.c there's a line in initGL that uses the image:

    // Load image into texture
loadTexture("Image.png", &Input, &renderer);

So you'll want to replace this with whatever image has been selected. NB the documentation on this sample does state:

// This is not a fully generalized image loader. It is an example of how to use // CGImage to directly access decompressed image data. Only the most commonly // used image formats are supported. It will be necessary to expand this code // to account for other uses, for example cubemaps or compressed textures.

So you'll find it's not general enough to work with any image. Stick with uncompressed PNG files.

Hope this helps!

ayreguitar