OpenTKstart's picture

Point of View


with this setting:

Matrix4 modelview = Matrix4.LookAt(Vector3.Zero, Vector3.UnitZ, Vector3.UnitY);

I get a point of view like this:

but i need a point of view like this:



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

You want to use a left-handed coordinate system (OpenGL uses a right-handed system by convention). A simple way to achieve this is to multiply your modelview matrix with a scale matrix of (1, 1, -1).

OpenTKstart's picture

But my modelview-matrix is a Matrix4 and i cant multiply it with a Vector3 (1,1,-1) ??

haplokuon's picture

The scale matrix of (1,1,-1) fiddler showed you means a matrix in cartesian coordinates
| 1 0 0 |
| 0 1 0 |
| 0 0 -1 |

OpenTKstart's picture

But the modelview Matrix is a 4x4 Matrix. I tried this:
| 1 0 0 0|
| 0 1 0 0 |
| 0 0 -1 0 |

But it didn´t work.

avc81's picture
OpenTKstart's picture

Ok, but when i zoom out, theres a point in which i cant see the objects which are far away, How can i stretch the range of view?


haplokuon's picture

When you create the projection matrix, orthographic or perspective, the parameters zNear and zFar control the clip planes of the scene. This defines the viewing volume, objects outside this volume are clipped and not drawn in the final scene.

OpenTKstart's picture

thanks a lot, but what are the 2 parameters "fovy" and "aspect" in that method and why are they often declared like this:

(float)Math.PI / 4 (fovy)

Width / (float)Height (aspect)

haplokuon's picture

Like in a real camera the parameter:
- fovy controls the field of view, the aperture angle measure in radians.
- aspect controls the aspect ratio of the view, window width / window height. It's like the aspect ratio of your monitor, you can find 4:3, 16:10, 16:9.

For an extended discussion check the internet, there are many tutorials that deals with the opengl basics.