View Full Version : Math-transformations question

This may be an obvious question for you but here it goes:

Given glFrustum(-1,1,-1,1,1,10); That means that the near frustum 'poly' has coordinates (-1,1),(1,1)(1,-1) and (-1,-1). If I want to know the coords of this same polygon after moving or rotating the camera what should I do to the vertices? Should I multiply the matrix by some other matrix?

Well, hope you can understand my question...cya!

You should multiply these four corodinates by the modelview matrix. But remember that you have to use homogenous vectors.

The coordinates you mentioned is the following as homogenous vectors: (-1, 1, 1, 1), (1, 1, 1, 1), (1, -1, 1, 1) and (-1, -1, 1, 1). The third '1' is for the near plane, and the fourth '1' is the fourth coordinate that makes it homogenous, more commonly known as W. This is, more or less, always 1.

Sure, I understand that, but if I multiply all vertices by the modelview matrix I will get the transformed vertices...What I want to do is to know the coordinates of this poly after moving the camera, so I can have the near frustum plane coordinates after doing some rotations/translations/etc. Imagine I want to draw the near plane frustum (pretty stupid, cause you will see nothing but a big screen sized quad) in front of the camera. What can you tell me?

Shouldn't you be doing all camera transformations using the modelview matrix anyways? In which case Bob's method works fine.

j

Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.