How would that calculate the FOV? You do realise the size of the object there/its distance to the camera will change when its corner reaches the edge of the screen. Try this:
#include "DarkGDK.h"
void DarkGDK ( void )
{
dbSetDisplayMode( 1024, 768, 32 );
dbSetCameraAspect( 1.0f );
dbSyncOn( );
dbSyncRate ( 60 );
dbMakeObjectCube( 1, 0.1f );
dbPositionCamera( 0.0f, 0.0f, -5.0f );
while ( LoopGDK( ) )
{
char TempStr [ 128 ];
if ( dbLeftKey ( ) )
dbTurnCameraLeft ( -0.1 );
if ( dbRightKey ( ) )
dbTurnCameraLeft ( 0.1 );
sprintf_s( TempStr, 128, "RotationY: %f", dbCameraAngleY ( ) ); dbText( 0,140,TempStr );
dbSync( );
}
return;
}
When the centre of the object reaches one side you'll see that the FOV is indeed just under 62, or half of that as you're only calculating the one side. You could also extract the FOV from the projection matrix, though not directly.