Kodeco Forums

OpenGL ES Transformations with Gestures

Learn all about OpenGL ES Transformations by making a 3D, gesture-based model viewer.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/2591-opengl-es-transformations-with-gestures

This has been a very useful tutorial in a project I am working on now - the rotation is exactly what I needed and the Translation of the gesture recognizers into a modelViewMatrix is perfect for manipulating my model also.

However… I am displaying objects that do not always appear in front of the camera and it would be better if I could position them with something like GLKMatrix4MakePerspective. This generates a matrix4 that takes the place of the modelViewMatrix that would normally come from the transformations class…

So I tried using the modelViewMatrix generated by GLKMatrix4MakePerspective and multiplying that by the modelViewMatrix returned by transformations. It almost works but rotations get pretty wacky.

Any ideas on how to set initial position, then apply transformations? Of course if I knew how to set the components of the GLKMatrix4MakePerspective matrix in terms of scale, translation and rotations it would be easy to set up transformations in that initial position and then go from there… but I don’t.

Hi There,

This is a very nice and informative tutorial, on top of this I am wanting to display the live camera behind the glkview. Tried multiple approaches but could not succeeded in it. Any help would be greatly appreciable.

Best Regards,

To do that I think I would use a AVCaptureVideoPreviewLayer in the parent view with the GLView as transparent. Have you tried this? I assume you are doing some kind of augmented reality project?

HI,

First of all thanks a lot for the reply, Yes I have tried that, I have made GLKView transparent but it is displayed as black. I have used one of your examples in my application.
https://www.raywenderlich.com/50398/opengl-es-transformations-gestures

Any help would be greatly appreciated.

Best Regards,
~Anup Rojekar

Have you tried using Reveal to view the actual states of all the windows in your application? When you see black it is hard to know whether you are looking through transparent layers to a black background or whether your front layer is black. Additionally you can see the state of each of the views and even alter them to see how you need to change the code.

This tutorial is more than six months old so questions are no longer supported at the moment for it. We will update it as soon as possible. Thank you! :]