Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / SetCameraOrthoWidth discrepancy between what the doc says and reality

Author
Message
TomToad
6
Years of Service
User Offline
Joined: 6th Jan 2018
Location:
Posted: 10th Apr 2018 10:29
The docs say that SetCameraOrthoWidth with default of 40 will cause a cube of 40 units to fill the screen. As you can see in the example below, this is not the case. The cube only fills half the width. If you count the spheres placed at 1 until intervals, you will see that the screen is actually 80 units wide. To have the cube fill the screen, you need to set a width of 20.
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 10th Apr 2018 22:40 Edited at: 10th Apr 2018 22:46
I guess it just means -40 and +40 width ?
Maybe he calculated the matrix instead of "1/width" like so "1/right-left" while right and left is 40
This is a very nice site to look up the render pipeline http://www.codinglabs.net/article_world_view_projection_matrix.aspx
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 10th Apr 2018 23:12 Edited at: 10th Apr 2018 23:13
SetCameraOrthoWidth() is technically incorrect. If you use SetCameraOrthoWidth(100) what you get is a view that is 200 units wide.

Its always twice the number you put in. As Janbo said this is most likely due to the way the projection matrix was set up in AppGameKit (+40,-40) and its not a problem really as long as you know about it. Ive never been bothered about it personally.

The documentation does specifically state that when setting the view width to 40 then a cube that is 40 wide will fill the screen.... and it doesn't (so it is wrong). Its half the width (due to the x2 scaling.) It doesnt cause a problem and wont cause a crash or anything but.... strictly speaking, either the documentation should be updated or the function itself changed to use half the value.

Login to post a reply

Server time is: 2024-03-28 10:02:56
Your offset time is: 2024-03-28 10:02:56