Must be a driver bug

Posted on:September 20 2010

If you tried out WebGL and never programmed realtime 3D graphics before, you might have stumbled over a small problem: Most of your textures are never shown, they all appear black. Some few users of CopperCube and CopperLicht reported this for example. Because these were only some very few people and I never received any example to reproduce this, I decided this must be a driver bug, something which still happens today [, shame on the 3d hardware industry :)].

Being an a bit experienced 3D programmer, it never came to my mind that the real reason for this problem was quite different: I am used to create textures with a power-of-two size, like 128, 256, 512 or 1024 pixels. Of course, people who never did any work in realtime 3D before have usually never heard of this concept, and simply use any size for their textures. Which resulted in some WebGL implementations treating these textures as 'wrong', refusing to show them without any feedback.

Some days ago I accidentally finally noticed the problem. It was also a bit sneaky because not all WebGL implementations do this, I guess currently only a few versions of Minefield. But anyway, I just updated CopperLicht (1.2.2) and CopperCube (2.0.1), and when using a texture with a non power-of-two size in there, it will be automatically corrected internally and will now still work then as well.


Just out of curiosity (I'm too lazy to check out myself), are you scaling the non-pot-sized input texture up to nearest pot-size, or are you padding some extra space there?

I have noticed that the Irrlicht engine solves this by scaling. Which of course makes it possible to still have tiling (uv wrapping) work correctly. However, that doesn't look good at all when working with 2D UI graphics and such, wanting pixel perfect stuff, in which case the right solution is to add empty stuff to texture to pad up to nearest pot-size. So I believe this choice should be up to user, who will know which one is the right way in the particular case. :)
2010-09-20 20:03:00

Add comment:

Posted by:

Enter the missing letter in: "Internati?nal"




Possible Codes

Feature Code
Link [url] [/url]
Bold [b]bold text[/b]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]