Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm currently facing some problems with sprites/images on different screen sizes. For now the game stage is stretched to maximum width and height of the screen.

In Samsung Galaxy S2, SGS3 and SGS4 the game is working as normal as expected: enter image description here

But... yesterday I tested it on GT-P5110 android tablet.. and the result was: enter image description here

The screen background and car sprite was replaced by black rectangles...

Does somebody know what's happening?

The same result occurs on sgs2/sgs3/sgs4 when any of the sprite image has more than ~4100px of height. Maybe it's something with image limits? If yes... how to know that limit? Currently (working on sgs2, but not on tablet) the background image size is 3117x480. It's so wide because it used for parallax background. If it exceeds the limit how should I handle this (join two images)?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Some Googling reveals that the max texture size may be 2048x2048 on the tablet, and your ~4100px limit implies a max texture size of 4096x4096 on the phones, though I've never seen this particular rendering artifact result from that. Generally the texture won't load at all, not somehow get its alpha component chopped off, but if that's the reproducible cause of the problem, then texture size must be it. Honestly it looks more like the alpha test or blend state is just wrong, but maybe the PowerVR drivers do something silly with over-sized textures instead of just erroring out on texture object initialization.

Yes, the correct thing to do in that case is to split your image up (preferably into power-of-two sizes that are within the GL_MAX_TEXTURE_SIZE size; you have to query it at runtime with glGetIntegerv or the like as the spec only guarantees a size of 64 texels to be supported by any particular device/driver.) You can then render multiple quads/triangles to cover the multiple source textures. With a little leg work you can set up a system to take any texture, split it into tiles of the maximum size, and then create both the necessary texture objects and vertices for the split image.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.