jenny_wui

07-03-2010, 01:18 AM

I have some basic questions about OpenGL.

My model is centred at ( -27.038612, -19.610632, 15.522789).

Bounding box of my Model is as follows:

Max_x: 3.604006, Min_x: -62.712784;

Max_y: 78.721275, Min_y: -104.043892;

Max_z: 70.194565, Min_z: -40.782883;

kFovY = 45;

I want calculate the value for ‘nearDist’ and ‘farDist’ for the following equation:

gluPerspective(kFovY, aspect, nearDist, farDist);

or

glFrustum(-aspect*nearDist*tan(kPI*kFovY/360), aspect*nearDist*tan(kPI*kFovY/360), -nearDist*tan(kPI*kFovY/360), nearDist*tan(kPI*kFovY/360), nearDist, farDist);

What is the ideal method for calculating these values from model bounding box and center of the model?

I also want to know what should be the following values:

‘gCameraPosWC[0], gCameraPosWC[1], gCameraPosWC[2]’ for the following equation:

gluLookAt(gCameraPosWC[0], gCameraPosWC[1], gCameraPosWC[2], 0, 0, 0, 0, 1, 0);

Thanks in advance for your cooperation.

My model is centred at ( -27.038612, -19.610632, 15.522789).

Bounding box of my Model is as follows:

Max_x: 3.604006, Min_x: -62.712784;

Max_y: 78.721275, Min_y: -104.043892;

Max_z: 70.194565, Min_z: -40.782883;

kFovY = 45;

I want calculate the value for ‘nearDist’ and ‘farDist’ for the following equation:

gluPerspective(kFovY, aspect, nearDist, farDist);

or

glFrustum(-aspect*nearDist*tan(kPI*kFovY/360), aspect*nearDist*tan(kPI*kFovY/360), -nearDist*tan(kPI*kFovY/360), nearDist*tan(kPI*kFovY/360), nearDist, farDist);

What is the ideal method for calculating these values from model bounding box and center of the model?

I also want to know what should be the following values:

‘gCameraPosWC[0], gCameraPosWC[1], gCameraPosWC[2]’ for the following equation:

gluLookAt(gCameraPosWC[0], gCameraPosWC[1], gCameraPosWC[2], 0, 0, 0, 0, 1, 0);

Thanks in advance for your cooperation.