getScreenCoordinatesFrom3DPosition rounding errors

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
agamemnus
Posts: 283
Joined: Sun Jan 31, 2010 6:06 pm

getScreenCoordinatesFrom3DPosition rounding errors

Post by agamemnus »

Ok, this one might be a newbie, not advanced, question. (why isn't there an "intermediate" forum? :D)

Has anyone used CSceneCollisionManager::getScreenCoordinatesFrom3DPosition extensively?

I'm not doing something right....I'm feeding it floats, but I think getting some sort of error. It's always off by 1 or 2 pixels, creating a shaking effect for my text and 2d rects when I move the camera. Something's not being rounded correctly.

I don't really understand all the matrix multiplication there, but something must be getting truncated. Not sure what since everything is a float except for "dim.Width" and "dim.Height". (I tried changing those to floats, no-go)

Tried a few things.. removing the last line rounding, using my own rounding, using 1.41 code... nothing seems to work.

Edit: I even tried sending back (32-bit ofc) floats instead of integers in a new function.... I think shaking is reduced now (for my text nodes), but not entirely.
agamemnus
Posts: 283
Joined: Sun Jan 31, 2010 6:06 pm

Post by agamemnus »

I guess it's just an issue of no anti-alias for draw2drect, and/or no fractional pixel positions..
Post Reply