PDA

View Full Version : Convert CGContextRef to CGImage to CIImage to OpenGL texture so can export a QT clip




Chirone
Mar 22, 2009, 08:27 PM
it sounds like a silly and long way to do things, and most certainly there is a better way to do it... to just get the current content's graphics port draw on it using CG methods like CGFillRect and CFContextShowTextAtPoint and then export the frames as Quick Time

but so far, i've only seen that you can get the current graphics port as an OpenGL thing and then export those frames as QT

i tried switching it over to CGContextRef but didn't know what to do from there... the rest of the method is drawing textures with OpenGL

so i found code here:
http://developer.apple.com/samplecode/CoreImageGLTextureFBO/index.html#//apple_ref/doc/uid/DTS40007889
which claims to convert CG stuff to OpenGL textures. but it makes CIImage and gives that instructions which is thrown onto the FBO...

so i thought maybe i could just convert the CGContextRef to CIImage, but there doesn't seem to be a method to do that
there is the CIImage's initFromCGImage method, but i don't know how to get the information to fill in the parameters


if someone can help me convert the stuff i drew onto the CGContextRef into a CGImage so i can convert it to a CIImage then please tell me or point me in the right direction

better, yet, if you can say my approach is a load of bull then proceed to point out a more efficient way of doing it then by all means, feel free