Retrospective bugfixes for the lessons

Don’t worry, the lessons will continue shortly! Things have been a little hectic with my day job recently, but I hope to be able to write up lesson 16 over the weekend.

In the meantime, some bugfixes to the older lessons, in particular those after lesson 11:

  • Chromium expert Ken Russell writes to point out that according to the OpenGL ES spec, on which WebGL is based, non-power-of-two (NPOT) textures — that is, those that have either a width or a height that is not an exact power of two, like 2, 4, 8, …, 512, 1024, 2048 — don’t work if “either the texture wrap mode is not CLAMP_TO_EDGE, or the minification filter is neither NEAREST nor LINEAR”. The normal settings for textures in my tutorials do not have CLAMP_TO_EDGE as a wrap mode, and use mipmaps for the minification filter. This used to not be a problem, because the WebGL implementations were forgiving and let me get away with something that wasn’t strictly correct; at least in part, this was because they’re based on the older “desktop” version of OpenGL, whose behaviour with NPOT textures is quite different. However, there were two problems: firstly, some people (who know who they are :-) found that the NPOT textures meant that their machines could only use software rendering, and slowed right down. And secondly, when WebGL becomes available on systems that only support OpenGL ES 2.0 and so have stricter interpretations of the standard, tutorials with NPOT textures will be broken for them. The WebKit team have, very sensibly IMO, decided to forestall this kind of problem, and have made their WebGL implementation strict right now — which means that as of a few days ago, the textures in these tutorials stopped working. I’ve taken the easy way out to fix this — I’ve been through all of the tutorials and simply scaled the texture GIFs and JPEGs to make them power-of-two sizes — so the moon went from being 1000×500 to being 1024×512. Hopefully they should all work for users of the most recent Chromium and WebKit; if you want to check them, here they are: 11, 12, 13, 14, 15, 16. Any feedback much appreciated!
  • Tobias Ritter (creator of those cool generated 3D objects) writes with another bug report — since lesson 11, the index buffers in the tutorials have all had an “item size” of 3 instead of 1… This doesn’t affect the behaviour of the programs — the variable is there for completeness only — but it was definitely wrong, so now it’s fixed. Hopefully it didn’t confuse anyone!
You can leave a response, or trackback from your own site.

12 Responses to “Retrospective bugfixes for the lessons”

  1. Springer says:

    RTT demo is now working fine for me.


  2. giles says:

    Excellent, thanks for letting me know!

  3. Denny says:

    Hi Giles,

    RTT now working for me two! Also Minefield on Snow Leopard. Thanks for pointing out the textures issue!

  4. Christofer says:

    On Minefield everything looks great, but when i set software render to true and start lesson 16, browser is crashed.

    On Chromium also everything is ok, but lesson 16 looks like the DEPTH_TEST set to disable. Sequence of display elements is incorrect.


  5. Pyro Technick says:

    RTT in lesson 16 now works on OSX.6.3/8600M/Chromium although I’m also experiencing the same depth buffer issues (the cube’s faces aren’t ordered correctly.

  6. giles says:

    Thanks, guys! Christofer — that’s a particularly interesting description of the depth problem (which Cid also spotted a while back: Perhaps I need to set the depth_test flag explicitly for the RTT framebuffer too… I’ll make that update and post again.

  7. Andrex says:

    Textures aren’t loading for me in Chromium 5.0.390.0 on Vista SP2 with –enable-webgl, but not –no-sandbox. :(

  8. giles says:

    Hi Andrex — just to be sure I understand — do you mean that they do load if you use –no-sandbox, but don’t if you don’t use it?

  9. Matti says:

    The live-demo for lesson 16 seems very promising, any idea when you might finish writing it?

  10. giles says:

    Things have been pretty busy recently, unfortunately — no ETA, sorry :-(

  11. Manish says:

    Hi giles, thanks for all the information related to textures. Just if you could tell how to use other size images as to where to set the attribute CLAMP_TO_EDGE. I tried quite a lot but couldn’t succeed. Thanks in advance.

Leave a Reply

Subscribe to RSS Feed Follow Learning WebGL on Twitter