A strange bug -bad image data

A strange bug -bad image data
0.0 0


I’m using large sprite sheets in my project. Most of them are 8192x8192 pixels and one is even bigger.
I was getting a strange bug where sometimes the sprites would appear as a black squares instead of the characters the sprite sheet contains. when running an animation the black square will animate as if the image is ok (I can see that cause the borders of the square are moving). after countless tries to re-publish the sprite sheets and run the program again and again with small changes in the way I’m loading the sprite sheets I noticed that I get this error:

WebGL: INVALID_VALUE: texImage2D: bad image data

now I get this error for two of my sprite sheets, and sometimes for only one of them, the related sprite in the project will appear as a black square. I do not get that for other sheets in my project, they are basically the same in size and in configuration but some how they don’t cause this bug.
does any one have an idea how can I go about solving this?


some more data.
this only happens in chrome


so I have set renderMode to 1 in my boot file (boot-html5.js)
var c = {...
that means I’m forcing the use of canvas 2d render context instead of web gl.
it pretty much solved the old bug, but causes another problem.
the transition from scene to scene is now much slower and in a scene where I have 2 big sprites animating together the animation is very very slow.
does anyone have any insight on this?


solved this by using an even larger sprite sheet (8192x16384 pixels) that contains both characters animation frames.
I hope this will help someone, but I also think this solution is not optimal, scenes switch much slower when canvas 2d context is used and this kind of solution will not work if I need to change my game to include more sprites per scene.
I can live with that cause I know I will not need to change things too much, but it would be great if you have any input for me about my issues- I feel like there are some things I don’t understand like:
what can cause an image to be “bad image” in web gl but work with canvas 2d context? what are the limitation for sprite sheet sizes? can some how make the scene transition quicker with canvas 2d context?


It is a strange behavior of chrome, some developers also met this problem, please refer to: http://code.google.com/p/chromium/issues/detail?id=115668