3D model over iPhone camera images. Transparent background? - iphone

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?

Related

How to take UIView screenshot in which AVPlayer is playing?

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

How can I fade a View with a CAEAGLLayer

I'm currently looking for a way to change the alpha value of a view with a CAEAGLLayer. Setting self.alpha doesn't work, so I think there must be some concept here I don't understand. The app I'm building has an opengl layer over live footage from the iPhone/iPod camera, and I'd like to fade this in and out. I've also tried setting the CAEAGLLayer's opaque and opacity value, which also won't work. Thanks for any thoughts you may have.
I am trying to do something similar, i.e. have just the background of the CAEAGLLayer be transparent, so I can draw over a photo. I have managed to fade the whole thing in and out setting the Alpha value on the layer itself in the layout editor of the Nib, which might work for you, but is not quite the effect I want. What I really want is just a transparent background and there is discussion of how to achieve that here:
http://www.iphonedevsdk.com/forum/iphone-sdk-development/20081-merging-content-uiimageview-eaglview.html
Although I haven't managed to get what they describe working yet ... :-(

Iphone core graphic, mask

I have a problem with the core graphic of iPhone. Below is a drawing which demonstrate this problem:
There is a mask with a human shape, I'm put the mask upon an image, I'm doing "something" (this is the part I need help with), I remove the mask, and finally the image became human-shape transparent.
finally I found the solution from the apple sample code called QuartzDemo.

How to do this FadeOut Effect with openGL on iPhone?

I'm playing around with the GLPaint Example from Apple.
But I don't know how to create an effect which fades the already drawn stuff out.
I created an example in Flash which shows the effect I'm looking for:
http://staging.rwichmann.com/openglexample/
In Flash I'm drawing a texture on a BitmapData and in every frame I'm adding a ColorTransform to the BitmapData which fades out the old drawn data.
I guess there must be a similar solution in openGL. Something with the renderBuffer or frameBuffer but I didn't find any solution.
Do you have an idea, tip, hint?
Just a suggestion. Not really that code related, it's art related. Create a long trailing art with diminishing alpha values until at the end of the art the graphic is transparent. Rotate and scale as necessary to match the turns and directions of the lead object. This can be overly simplified but will also work with Quartz. If you go 3D you have to consider the rendering direction to the camera and apply a similar series of fading alpha textures.
sorry, no real code to show you.
Best regards,
Natchaphon

draw circle on MKMapview in iphone app

I am trying to draw circles around the current location on MKMapview.I tryied many codes but however no success. can any one suggest any links which should I refer. I am new to Iphone so dont have much knowledge about Quartz 2D.
I would think the simplest method to achieve your goal would be to use a custom PNG image with transparency and set the image property of a MKAnnotationView that you add to your current MKMapView.