Question

Is it possible to set up GL_PROJECTION in OpenGL to compensate screen rotations?

I think there is a lot of applications to that, in augmented reality or stereoscopic views, for instance.

Particularly, I would like to make a "fake" change of perspective when the mobile device is tilted.

This effect is shown in the imageenter image description here

Was it helpful?

Solution

Actually your particular case requires adjustment of both the projection and the modelview. The modelview is responsible for setting the point of origin. By having an angled view the vantage point shifts. However also the lens get shifted (literaly, it's just like a shift lens on a real camera), that requires a shift term.

Now your sketch is a bit unclear on what actually is desired. What I can clearly say is, that it's not rotated, but shifted. Suggestion: Download Blender, set up a simple scene and tinker with the "Shift" parameters of the camera object; as you'll see you will have to apply a combination of lens shift and camera shift.

But generally speaking: Yes, adjustment of the projection matrix is required in some situations.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top