How should I translate an OpenGLES modelView to a CATransform3D? How should I translate an OpenGLES modelView to a CATransform3D? ios ios

How should I translate an OpenGLES modelView to a CATransform3D?


It's probably to do with the setup of your views in the first place. A strange offset could be caused by the width and height being the wrong way around or any other possible incorrect values like using an iPhone screen-ratio on an iPad.

Is your app landscape? If so then give it a go in portrait. I've noticed in the past that apps always seem to launch with portrait screen dimensions (I haven't confirmed this though) so if your view setup happens before the screen is the 'right way' around you'll get a mismatch.

You might also try working out exactly how much it's off by. Instead of multiplying size.data as a hack: add another translation and tweak the numbers till it's right. Those numbers might give you some better insight into what's happening. *10 is probably just pure fluke and doesn't mean anything much.