Must be a driver bug

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.

Only one comment:

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. :)
tonic (link) - 20 09 10 - 20:03


Name:  
Remember personal info?
yes
no
Email (optional):
URL (optional):
Enter "layered" (antispam):
Comment:Emoticons / Textile

  ( Register your username / Log in )

Notify: Yes, send me email when someone replies.  

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.
Note: If you type in your email adress above, it will be visible to other visitors, although it will be hidden for bots using javaScript.