WebGL around the net, 28 Nov 2009

Wow, the demos are coming thick and fast now — today’s is from Coolcat, and is the first steps towards a clone of the popular KDE game “Konquest”, in which you can fly around a model of the solar system (just the Sun, Earth and Mars for now). To control it, use WASDQE to move, drag with the right mouse button or control-drag to spin the camera, and zoom in and out using the mouse wheel. (Be warned, if you tried the version Coolcat linked to in the comments here the other day and got errors, you may need to go here and hit shift-reload to make sure your browser cache is properly cleared.)

One particularly impressive thing about this is that, to quote Coolcat: “I’m using GoogleWebToolkit, so this 90% coded in Java and then translated to JavaScript.” So WebGL is not just for JavaScript coders any more :-)

There’s a full description of the project (in German) here, and here’s a Google translate link for English-speakers.

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

14 Responses to “WebGL around the net, 28 Nov 2009”

  1. ksad says:

    Does not work, removed cache:

    20:03:04.438 Caught exception in mainloop:
    (NS_ERROR_FAILURE): Component returned failure code: 0×80004005 (NS_ERROR_FAILURE) [nsICanvasRenderingContextWebGL.texImage2D]
    QueryInterface: function QueryInterface() {
    [native code]
    }
    result: 2147500037
    filename: http://www-users.rwth-aachen.de/martin.weusten/develop/uc/uc091125/UltimateConquest/0898208CB749C0E717E492C3AB0890DC.cache.html
    lineNumber: 961
    columnNumber: 0
    inner: null
    data: null
    initialize: function initialize() {
    [native code]
    }

  2. ksad says:

    And firefox console says texImageID: array dimensions too small for width, height and pixel format.

  3. giles says:

    ksad — what graphics card and OS do you have?

  4. ksad says:

    ATI Mobility Radeon HD 4300 Series, Ubuntu 9.10, ati catalyst driver.

    All the other WebGL code does work great.

  5. Coolcat says:

    This version should also work with Google Chrome. At least I tested it successfully on Vista 64bit:
    http://www-users.rwth-aachen.de/martin.weusten/develop/uc/uc091128/UltimateConquest.html

    @ksad: Could please try the new version? It was compiled with “pretty” option, so the generated code is much better readable and the line number in the exception is much more useful.
    However, I think I got the problem: I’m using a workaround for texImage2D. There is a bug in texImage2D which prevents to initialize an empty texture. For that reason I create an WebGL array with the correct size first:
    new WebGLUnsignedByteArray(new WebGLArrayBuffer(3*x*y));
    That does work for me. Which version of Firefox/Minefield are you using? Have you tried to update to the current nightly build?

  6. ksad says:

    Latest nightly (Gecko/20091129).

    14:55:19.217 Caught exception in mainloop:
    (NS_ERROR_FAILURE): Component returned failure code: 0×80004005 (NS_ERROR_FAILURE) [nsICanvasRenderingContextWebGL.texImage2D]
    QueryInterface: function QueryInterface() {
    [native code]
    }
    result: 2147500037
    filename: http://www-users.rwth-aachen.de/martin.weusten/develop/uc/uc091128/UltimateConquest/39B5AE67FE49916FF8AF417C71780E1C.cache.html
    lineNumber: 8113
    columnNumber: 0
    inner: null
    data: null
    initialize: function initialize() {
    [native code]
    }

  7. Coolcat says:

    @ksad: Does the “Error Console” say something? (Firefox => Tools => Error Console)

  8. ksad says:

    @Coolcat, yes as before: “texImage2D: array dimensions too small for width, height and pixel format.”

  9. Coolcat says:

    @ksad: Oh, you wrote that earlier, sorry. My current theory is that, for some reason, your graphics driver does not support RGB textures. It does need RGBA as input for texImage2D. I have now increased the buffer size to 4*width*height. That’s stupid, especially because I just need an empty texture, but might work.

    Please try this one:
    http://www-users.rwth-aachen.de/martin.weusten/develop/uc/uc091129/UltimateConquest.html

    Could you also check what the values of GL_RGB and GL_RGBA are in ‘/usr/include/GL/gl.h’, or where ever your ‘gl.h’ is. It should be 0×1907 respectively 0×1908.

    Thanks.

  10. giles says:

    Something that might be completely irrelevant but might help — I remember from early versions of the NeHe tutorials that in some cases (I think in particular if you’re not using mipmaps) OpenGL can require textures to be square and 2**n pixels on a side (eg. 16×16, 256×256, etc).

  11. Coolcat says:

    @giles: Good point. Since the texture has framebuffer size which matches the browser window size, it has arbitrary size. However, that does only affect old graphic cards. According to Wikipedia the HD 4300 Series is based on the R700 chip which does support OpenGL support 3.1. However, since ATI linux drivers are updated slowly it might be an driver issue.

    @ksad: Does your card/driver support the ‘GL_ARB_texture_non_power_of_two’ extension? E.g. you could try something like:
    glxinfo | grep “GL_ARB_texture_non_power_of_two”

    If the 4*width*height does not work in my special case copyTexImage2D might be also an option.

  12. ksad says:

    No the driver doesn’t support it.

  13. ksad says:

    I found it does work in Chromium…

  14. Coolcat says:

    Hm, that’s strange…in that case it’s not the hardware/driver.

Leave a Reply

Subscribe to RSS Feed Follow Learning WebGL on Twitter