Changing back and forth…

As they say, it’s six of one and half a dozen of the other… I’ve made some more retrospective changes. The good news first:

On the WebGL Wiki, Gman just removed the code saying gl.enable(gl.TEXTURE_2D) from the tutorial, saying that it’s not required, or indeed valid WebGL! I checked on the mailing list, and that’s entirely correct. The TEXTURE_2D constant was misplaced in the spec, which might have been the cause of the confusion. So I’ve removed that from all the lessons, and you can get rid of it from your code too :-)

From the good news to the neutral news: a number of people who were running Safari on Macs found that they couldn’t see the texture, or indeed the lighting, for lessons 11 and 12. I’ve finally worked out why: Safari doesn’t like PNG textures, or at least the specific PNGs I was using. I need to put together a good test to reproduce this so that I can report it to the WebKit team, but for now I’ve switched to using GIFs for all of my textures, and you may want to think of doing likewise. A problem, but there’s an easy workaround for everyone to use in the meantime.

From the neutral news to the, well, not so great. As I said the other day, WebKit doesn’t seem to support the flipY flag for texImage2D. So I’ve backed out the change that I’d made to use that, and once again the textures are being flipped by code in the fragment shaders.

[UPDATE as of 13 March 2010, the problem with flipY seems to be fixed, so we're using it once more.]

You can leave a response, or trackback from your own site.

8 Responses to “Changing back and forth…”

  1. murphy says:

    Now Safari on Mac OS X it says:

    ERROR: 0:7: ‘-’ : wrong operand types no operation ‘-’ exists that takes a left-hand operand of type ‘const int’ and a right operand of type ‘float’ (or there is no acceptable conversion)

    or something like this for every lesson. Maybe it’s a bug in the current nightly build. I don’t know.

  2. giles says:

    Whoops, sorry, and thanks for telling me! I think you may have encountered that while I was fixing it just now — I realised that I used “1 – vTextureCoord.t” rather than “1.0 – vTextureCoord.t”; the first works on my PC but not on Macs. I’ve fixed it and it should work now — could you have another look?

  3. murphy says:

    Works, thank you.

    That’s weird, though. I’d expected something like this to be defined behavior of GLSL: either “int – float” is valid, or not. Such quirks makes developing platform-independent code a headache, quite the opposite of Khronos’s goals.

    So, I’d love to file a bug ^_^ Do you know where?

  4. giles says:

    Agreed, this does sound like it should be solidly specified somewhere. Perhaps someone on the mailing list would know where?

  5. titan says:

    Hello again,

    why not flip the Y-texcoords (1-coord) in the array. It means calculating once at model-data-creations?

    creatings
    Titan

  6. giles says:

    Yes, that would work — but then the texture coordinates would have t increasing from the top of the image to the bottom, while the vertex position coordinates would have y increasing from the bottom to the top. I’d personally find this confusing! I think I’ll just wait until WebKit adds support for the flipY flag, then reintroduce it.

  7. titan says:

    If you use only you own stuff, you can note it and flip the picture with a paint programm ;)

    greets

  8. giles says:

    That’s true! Still, I’m hoping they’ll implement the flag in WebKit soon, and then I can just remove the “1 – ” stuff once and for all.

Leave a Reply

Subscribe to RSS Feed Follow Learning WebGL on Twitter