I'm planning to do a HUD for my little shooter game which you can find here : http://www.eve-corp.com/Raptor and I was wondering whether to use the 2D drawing functions offered by the driver interface or the scene-managers billboard functions.
Also, I was wondering about generals pros & cons of the 2D drawing functions.
thx in advance
I'm currently using the 2D drawing functions to do my HUD and everything works fine. Except for some reason one time my crosshair had little specks around it and I could not make them go away. I decreased the size of the crosshair jpeg and they're not there anymore.
the specks around the crosshair seem to be a result of bi-linear filtering. Turn it off, and the specks will disappear.
Concerning the coordination translation : There is a function pair which is able to convert screen coordinates to world coordinates and vice versa. I just forgot the name, sorry
Maybe it's somewhere in the camera classes ...
I don't think mine were from bilinear filtering, the specks were inside the transparent area of my crosshair which was black in the crosshair jpeg. No matter how many times I went back and blacked out my crosshair pic, they were still there in the same places each time I ran the game. I tested it on a bunch of computers too with all different kinds of video cards and had the same results each time. The only fix was to make the crosshair pic smaller for some reason. Strangely enough, this is the only pic thats had this problem in my game as I have loaded many others into the game without any problem. Like the cockpit, which covers the whole screen and has blacked out windows.
virtual core::position2d<s32> irr::scene::ISceneCollisionManager::getScreenCoordinatesFrom3DPosition ( core::vector3df pos,
ICameraSceneNode * camera = 0
) [pure virtual]
Calculates 2d screen position from a 3d position.
Parameters:
pos: 3D position in world space to be transformed into 2d.
camera: Camera to be used. If null, the currently active camera is used.
Returns:
Returns the 2d screen coordinates which a object in the 3d world would have if it would be rendered to the screen. If the 3d position is behind the camera, it is set to (-10000,-10000). In most cases you can ignore this fact, because if you use this method for drawing a decorator over a 3d object, it will be clipped by the screen borders
the 2D drawing function seem to lack the alpha-blending feature somehow. Is that possible ? I tried to load a 32bit un-compressed TGA, but it wont show up if I set the "useAlphaFromFile" bool to true.
And makeColorKeyTexture(..) doesn't do anything but convert my transparent color ( pink ) into pure black. Doesn't make much sense for me. Anybody has an idea ?
Perhaps the speckles were generated during jpeg-compression. Very fine structures like Lines or Text will receive some noise at higher compression rates. Maybe that is the Problem. Try to Load the crosshair as BMP.
[dx/x] where in your source bitmap is the picture? in mine it was at the left edge... maybe that's the problem? what happens if it is moved to the right of the bitmap away from any borders
@IsoGod regarding your color keyin problem:
Do you use the DirectX driver? Afaik that's the way the ColorKey function works in DX. At least the DX9 SDK mentions this. Don't know about DX8 or OpenGl. So if Irrlicht just uses the DX function that would explain why the color keying function does... er... what it does
Btw, I'm not sure if the function affects the alpha channel in any way (given the selected display mode supports an alpha channel)