开发者

iphone - Displaying the videocamera as background with OpenGLES models on top

Hi I'm having difficulties setting as background the Iphone's 4 videocamera and drawing simple cubes with openglES on top. What's the best way to achieve that? My project structure is simple, i have in the delegate the opengl class which draws the cubes perfectly and the controller doesn't do much.

So aparently the camera controller is the following code which gas to be set in the opengl view class, but it's not working.

UIImagePickerController* imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.navigationBarHidden = YES;
imagePicker.toolbarHidden = YES;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.showsCameraControls = NO;
imagePicker.cameraOverlayView = self;

// The 54 pixel wide emp开发者_高级运维ty spot is filled-in by scaling the image.
// The camera view's height gets stretched from 426 pixels to 480 pixels.

float bandWidth = 54;
float screenHeight = 480;
float zoomFactor = screenHeight / (screenHeight - bandWidth);

CGAffineTransform pickerTransform = CGAffineTransformMakeScale(zoomFactor, zoomFactor);
imagePicker.cameraViewTransform = pickerTransform;

m_viewController = [[UIViewController alloc] init];
m_viewController.view = self;
[m_viewController presentModalViewController:imagePicker animated:NO];

Any tips?

Thanks


Check this example (this is exactly what you need).


You can try sample code for AR from here.
Not 100% what you looking for, but might be helpful in this situation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜