# Thread: Unit of length in OpenGL

1. ## Unit of length in OpenGL

Dear everybody,

I got a question about unit of length in OpenGL. Assuming that I want to render a cube with the length of the sides of the cube is 20 millimetre, then what number I have to put in command glutWireCube( ???? f)

2. ## Re: Unit of length in OpenGL

I got a question about unit of length in OpenGL.
There is no unit of length in OpenGL. It is whatever you want it to be, based on your projection matrices and camera location.

3. ## Re: Unit of length in OpenGL

You simply assume any unit you want.
For example - you may assume unit is 1m and draw cube that has size of 0.02 or you can assume it's 1mm and draw a cube of size 20.
You just need to use the same units when defining your view
frustum (projection matrix).

I always use 1m since it's the basic unit used in many physics related formulas.

4. ## Re: Unit of length in OpenGL

Thank you.

but It's hard to understand, an example woulb be helpful for me

5. ## Re: Unit of length in OpenGL

That means is the size of cube you look at the screen can be looked has the different size through the projection matrix with different parameters although you set the same size for the cube.
Note,you are draw in the space of virtual world,not the real world.

6. ## Re: Unit of length in OpenGL

In short : use the units you want, it will not matter.
It can be 1 gl unit = 1 meter, 1 inch, Pi*lightspeed, whatever.

7. ## Re: Unit of length in OpenGL

I usually use 1 unit = 1 meter, it makes everything easy when adding motion, physics and stuff like that, as you can just copy the values and formulas directly from an SI based physics book.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•