I have a class which is responsible for building sprites (textures) together from sprite parts. This class worked well till the last patch, when the sprites (textures) started becoming simply transparent. I figured out that it’s not an asset loading issue, since the asset loader does not throw exceptions. Also when loading simple textures from the assets, without using the sprite creator, everything is fine.
The code of the class:
This sprite creator is based on a texture drawer which was posted here in the forums.
I use it as follows:
First I set the individual texture parts with the set methods. After this is done I combine them using the combine method and then get the texture with getTexture.
This worked all well till Friday. After a patch it started to produce simply transparent textures. And I haven’t touched this or related code for weeks.
Looks like my sprite creator is fine then?
Well the code itself look fine so far, can’t see any simple reason why it should not work.
Could it be that not the picture data itself is wrong, but that the material you use for rendering might be the problem?
For a first test, try what happens if you set alpha fixed to opacue in the generator. At least you should get a nontransparent texture then, and see if the color data is correct inserted. Might just be something simple like the alpha data is now used instead of ignored or similar.
When I set the alpha to 255 it renders a black texture.
It doesn’t draw the pixels apparently.
Are you using a canvas-based jme3 app? I think there might have been changes lately that switch the image buffer format so it can be more easily transferred to AWT.
I’m using SimpleApplication and I have no canvas.
setPixel() and getTexture() work fine. When I just use these everything is ok.
Ok, the problem seems to be in line 125. It never enters that if part as it seems. Any idea why?
How have you determined that?
Oh, I shouldn’t say never in general. It never enters it in my program execution.
But how do you know it’s not executing that specific line? Did you put println’s in? Run it in a debugger? Or are you just making assumptions because you are not seeing the behavior you are expecting?
…just trying to figure out how best to proceed next.
I added a println in that part. It didn’t get executed.
put more printlns in to figure out if the outer method is even getting executed, etc… if partToDraw is null then you have some weird issue but so far I don’t see anything jme related.
It gets executed and part to draw isn’t null.
I tried the following now:
[java] Texture bla = assetManager.loadTexture("/Textures/base/0/0.png");
It printed false. Is this normal?