One Pixel Unit

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Voxel
Posts: 8
Joined: Wed Feb 23, 2011 9:04 am

One Pixel Unit

Post by Voxel »

Hi,
I'm searching for a way of getting/computing the unit value for one pixel.

For example, if I want to draw a line of 1000 'Irrlicht-Units', what is the line length in pixels?
Some pseudo code:

Code: Select all

int nLineWithInPixel = 1000/OnePixelUnit();
if (nLineWidth < 4)
{
    // do something
}
I think it depends on the current zoom factor but I have no clue at the moment...

Is such a function already available or can anybody advise me how to compute this?

Thanks in advance!
Voxel
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

This completely depends on the distance of the camera from the object you're calculating the pixel-length of, the camera's FOV, aspect ratio, and a lot of other factors, so it's not all too easy to calculate

Why do you need this, and isn't there another easier way to accomplish what you want to do?
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Post by stefbuet »

Maybe you could use the CollisionManager::getScreenCoordinatesFrom3DPosition to do that. (you want to know how many pixels are between two 3D positions?)
Post Reply