Originally posted by ioquan:
[b]If you have your orthographic projection set up and the model’s bounding box, scaling it to fit the window is simple. Note that scaling is just multiplying each vertex by a scalar. If the model’s bounding box is twice as big as the viewing volume, you just scale it by 1/2. So its viewing_volume/bounding_box.
If you want to do OpenGL, you’re going to need to learn how to solve simple mathematical problems like this.
[/b]
Thanks for pointing out this is a simple math problem.
But I guess you might mis-understand my question. I don’t want change my model by multiplying any value to its vertics, instead, I like to know how can I use the glScale(value,value,value) to change the transformation matrix, so that the model object can be shown properly in the graphics windows.
Let say the Ortho Volume (X:-10 to 10, Y:-10 to 10, Z:-1000 to 1000), and the bounding box of the object is (X:-5 to 5, Y:-5 to 5, Z:5 to 5), now you see the formula you gave me will end up (20202000)/(10100) = inf?
Ok, now look at the other case, suppose my model object has (X:-5 to 5, Y:-5 to 5, Z:-5 to 5), now according to your fomula, I will have (20202000)/(101010) = 800, either I time 800 or 1/800 to the vertics of the model object, I don’t think the model object will fit as much as possible in the graphics window? Am I doing something wrong?
Sorry I just new, Can anyone tell me what I did it wrong?
Thanks.