PDA

View Full Version : so, how big is an OpenGL unit?



Structural
12-09-2002, 10:32 PM
I've been wondering what the real-life size of a single openGL unit is, and how big your worlds are.
How do you decide the metric unit of a model of yours? Do you adjust the model or the view frustum to get a nice size.
I'm merely asking out of curiosity http://www.opengl.org/discussion_boards/ubb/wink.gif

Mezz
12-09-2002, 11:36 PM
OpenGL doesn't define how big a unit is (if you're talking about the units such as arguments to glTranslatef() calls). You can define the unit size based on what you want your application to look/feel like. You just have to work out what seems best for your situation and stick with that.

-Mezz

[This message has been edited by Mezz (edited 12-10-2002).]

Structural
12-10-2002, 12:14 AM
OK... but what if you've put tonns of work in your app and models, and you want to adjust the scale just a tad, do you adjust the frustum or the models? If the frustum, how do you do that?

satan
12-10-2002, 02:32 AM
Originally posted by Structural:
OK... but what if you've put tonns of work in your app and models, and you want to adjust the scale just a tad, do you adjust the frustum or the models? If the frustum, how do you do that?

I am not really sure what you mean by adjusting the frustum. But I think it is best to build your model just in your desired scale. For example 1 OGL unit = 1 meter, etc.
If you did not do that it is perhaps the easiest to use the modeller you build them with for scaling them. Or you may use glScale.
For changing your view frustum take a look at the specs for glFrustum or gluPerspective.

GameMaker
12-10-2002, 05:53 AM
I agree that you should build your models to their real life scales. You can think of an opengl unit as whatever size you desire. If you want a unit to measure 1 meter, then the artist building the model should also set his modeling program to be 1 unit = 1 meter.

Also, if your models are too large, you can just move the camera back farther until they are at the size you want. And just think of 1 unit = 1 mile (or whatever).

nexusone
12-10-2002, 06:04 AM
The OpenGL unit not a defined size like meters or inchs, it is a relative unit.

Sometimes this is a hard concept to understand, but if you look why it is important to work in relative values it will become more clearer.

I a CAD (Computer Aided Design) we would enter the size of our object in real values.
Since the object size is important in building a real object.

Note if we where creating a CAD program we would have two sets of values. One set would be the real size values of the object, the other set would be the values relative to the view of the object.

Example in order to view a 100 meter object on the screen in which we have a 10 unit openGL window, we would have to reduce the object by 10. (100 m = 10 gl units) or say we wanted to zoom in on a area, then the maybe 1m = 10 gl units.


But in a 3D game world, we really don't care if the object is 300.3 cm. only that is it preportional to the other objects in the 3D scene.

So in our 3D world, our object maybe 300 units or maybe only 3 units long depending on your world size.

example:

world_size(); // World size is 10 units

draw_house(); // House is 1 unit in size

draw_car();// car is 100 units in size

We need each object to preportional to each other and the world

glScale(2.5, 2.5, 2.5); // increase house size by 2.5
draw_house();

glScale(0.01, 0.01, 0.01); // Decrease car by 100
draw_car();

I hope this gives you an idea


Originally posted by Structural:
I've been wondering what the real-life size of a single openGL unit is, and how big your worlds are.
How do you decide the metric unit of a model of yours? Do you adjust the model or the view frustum to get a nice size.
I'm merely asking out of curiosity http://www.opengl.org/discussion_boards/ubb/wink.gif

12-10-2002, 05:58 PM
There is no reason to define a unit because it all depends on what you're doing. Your objects need to be sized relative to each other, and YOU define what 1.0 means in your world.

For instance, one day you might make a scene that consists of the earth and the moon rotating around it. In this case the unit 1.0 in OpenGL might mean 500 miles. The next day, you might make a scene of a huge battle between an amoeba and some protozoans. Now you see that 1.0 in OpenGL might mean 500 micrometers. As long as your objects are correctly sized with respect to each other, it doesn't really matter what the units are.

Structural
12-10-2002, 10:10 PM
So, it's merely trail and error to find the right size of an unit/model!
http://www.opengl.org/discussion_boards/ubb/smile.gif
I think I got my question answered.