I have been trying to find a way to load images with sizes that are not powers of 2. I tried to have a texture target that is the next higher power of 2 and draw the image to that but the alpha on the image gets applied to a black background on the texture, even if I set the clear color to 0.
Is there a good way to get this to work?
Loading different size images in emscripten
Re: Loading different size images in emscripten
Sorry, need a bit more details to understand what exactly you are trying. Are you trying to pad the image so it keeps the original size but has some invisible alpha part? (I do something like that here: https://github.com/mzeilfelder/irr-play ... adding.cpp)
There's 2 parts you have to be careful about. First when drawing make sure it uses the alpha, for example when you use draw2DImage it has parameter for that. The other thing is make sure your image format actually has an alpha channel. Like the example I linked doesn't - so it will be black. But when I pass irr::video::ECF_A8R8G8B8 to createImage then the background will be transparent.
There's 2 parts you have to be careful about. First when drawing make sure it uses the alpha, for example when you use draw2DImage it has parameter for that. The other thing is make sure your image format actually has an alpha channel. Like the example I linked doesn't - so it will be black. But when I pass irr::video::ECF_A8R8G8B8 to createImage then the background will be transparent.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Loading different size images in emscripten
It looks like you did this with the IImage rather than using a texture target. I should have looked at the IImage documentation more.
Thanks. I think this is exactly what I needed.
Thanks. I think this is exactly what I needed.