I've been busy making a new version of my 'hyper-blazer' game; 'hyper-blazer 2' if you will. This time with lots more eye-candy

I'm using libgdx, which so far is great. Running on both desktop and android Just Works, awesome!

I'm using 2 cameras; one for 3D and one for 2D.First I render the 3D scene using the perspective camera, which works fine.Then I switch to the ortho camera and use SpriteBatch to draw my overlays (virtual sticks for Android in this case).

Now the problem is that the textures I want to draw just show up as white blocks.The problem is not the textures themselves; in a simple standalone test they show up fine.

I read that SpriteBatch requires a 'clean' OpenGL state, so I disable culling, lighting etc before using the SpriteBatch, but this didn't seem to help.

1. are your textures in a base 2 dimention? with some devices if you texture is not 128x128 or 256x256 etc... then they will be rendered in all white....2. make sure you have blending enabled.... and set the correct blending func3. make sure you enabled texture 2d

1. Yes, the textures are in base2 dimension. They show up fine in a small trivial test program, and I can also see these textures in the 3D scene.2. Blending is indeed enabled. Interestingly in my small test program I didn't explicitly enable blending, yet the texture shows up fine still (and with blending). 3. Texture2D is also enabled. Textures without alpha show up fine.

I guess I'll have to check in the SpriteBatch source to see what it's actually doing. I have the feeling there is something in my OpenGL state when I use SpriteBatch that it doesn't expect, but so far I couldn't deduce what it actually is that is screwing things up.

It turned out to be a general OpenGL issue that had nothing to do with SpriteBatch (a really stupid bug in my code in the way I binded textures), which I eventually found by putting LWJGL in debug mode.Now all works fine

Strangely enough it only works the first time on android (on desktop it's all fine).When I start the game a second time without re-installing, no textures are rendered at all (as if enabling textures is completely ignored; it's all just coloured blocks)If I re-install, it looks fine again...

Ok, found it.My engine was a singleton implemented as an enum. It seems Android doesn't necessarily re-initialize this enum when the app starts, so its state was all wrong the second run. Now I initialize the engine in the resize() method and all is fine now.

Yes, android has some gotchas to be aware of.Another thing that bit me in the past is that static values can just be reset at any time, so for example a traditional singleton or a class with static values doesn't really work in Android (not reliably anyway).

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org