View Full Version : Unit of length in OpenGL
11-15-2007, 10:23 PM
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)
11-15-2007, 10:29 PM
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.
11-16-2007, 02:31 AM
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.
11-16-2007, 04:06 AM
but It's hard to understand, an example woulb be helpful for me
11-16-2007, 07:36 AM
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.
11-16-2007, 09:27 AM
In short : use the units you want, it will not matter.
It can be 1 gl unit = 1 meter, 1 inch, Pi*lightspeed, whatever.
11-16-2007, 12:51 PM
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.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.