I have a UIImage.
I have an EAGLView in my app, which is a derivative of the GLPaint ("Shake Me!") sample program.
The UIImage is full-screen (320x480.) Actually, it's a screen-capture of the EAGLView's image from earlier in the program (like in this question.)
I'd like to set the layer-contents of the EAGLView to the image, and then continue drawing on top of that.
Hints? Pointers to sample code? Docs to read?
Thanks!
It turns out that EAGLViews can be stacked just like UIViews (and they can be intermixed), with transparency, so things were much easier than I was trying to make them.
Related
I am trying to generate a video from the screenshots taken from a specific UIVIew. This view have an AVPlayer subview and also a canvas subview(in which we can draw shapes). Just tried the normal way of UIGraphicsGetImageFromCurrentImageContext and the screenshot was black. I think its because the video is rendered in GPU.
So I tried to take a screenshot of a GLKView to which the above two subviews were added. But still its giving the GLKView background colour as images. Referred the below two links for my purpose.
Tried adding glkview as in this post.
Taking screenshot from a GLKView
Am I going the right way? If yes, Please help me to understand what I am missing.
OR
Is there anyother better way to do this? AVAssetImageGenerater is not at all suitable for my requirement and so I cant use it too.
AVAssetImageGenerater is not at all suitable for my requirement and so
I cant use it too.
What is the reason for this i don't know but by using AVAssetImageGenerater it is possible to take snap of the video and draw the snap image over the screenshot image is easy as you know the frame of the black part.
See below post to put a UIImage over another UIImage.
Draw another image on a UIImage
I'm trying to make an augmented reallity app for iPhone where you can see, over the camera images, 3D models built using OpenGL ES. I've already made the part where I get the images from the camera and a GLView that inherits from UIView where I draw the model. My problem is that when I put the GLView over the camera images, you don't see only the model but a black rect covering all the view. I've tried to colour the background so it becomes transparent but I haven't got it. Do you know which one could be the problem?
Thanks a lot!!
I answer myself. Appart from using glClearColor when you draw the OpenGl View, you need to have in mind to things:
When you create your CAEAGLayer object, you have to assign its opaque property the value NO.
When you assign the drawableProperties, you have to choose a color format that admits transparency, for example kEAGLColorFormatRGBA8.
Hope this will be useful to someone else! Thanks Benjamin Andris for your answer anyway! :)
Have you set the 'opaque' property of your GLView to NO?
I am making an app for the iPad/iphone and I want to have a star that tinkles every now and then and/or a rocket that shoots up randomly . What would be the best way to do that? Someone told me to use SVG and another told me that GIFs would be just fine.
SVG isn't going to work unless you are displaying the content in a UIWebView, you can either build the views using drawing code and perform the animations with core animation or use images, the first being far more efficient. Check out Apple's Core Animation Guide for more information.
UIImageView has a property animationImages which can be an array of UIImages. That'll certainly be lighter than a web view!
UIView animations are pretty elegant, though if you're code-phobic they're probably not for you. Don't let the affine transformation stuff scare you, it's simpler than it looks.
I need your help to know how to create an iPhone application to show a photo with SCRATCH OUT EFFECT.
Something like the effect in this flash tutorial
http://www.tutorial5.com/content/view/115/46/
Please help.
Thanks.
You can have a look at the following post on how to create a blurred image effect, I don't think it's the best & fasted method, but it might get you started:
UIImage blur
You can implement the scratch out effect by using CoreGraphics.
Subclass UIView for the scratchable image.
Draw the scratchable image, use a mask to cut out the parts of the image that gets "scratched".
Each time the user scratches the image, make it so the mask and the image gets updated.
Full code example on github
Does anyone know of a way to simply and effectively brighten a UIImage by a specific amount? I am currently fiddling with the Apple Sample Code Example GLImageProcessing with poor results...My app currently does not use OpenGLES or EAGLViews and it is awkward trying to bridge the technology.
You could render the UIImage into a CGBitmapContext. And then you should have a pointer to the raw bytes of the image. At that point you could do anything you'd like with the bytes, including brighten them. After that you can create a new CGImageRef from the bytes.
This would all be on the CPU, which might not perform as well as an OpenGL solution depending on the image size.
That depends what you mean by "brighten". You can overlay colors easily, and you can probably figure out some blending mode that will do what you want. Look through the CG functions and documentation (I'd post in more detail, but I can't right now).