Results 1 to 5 of 5

Thread: Floating point textures?

  1. #1
    Junior Member
    Join Date
    Apr 2010
    Posts
    22

    Floating point textures?

    For GPU based simulations (e.g. solving equations with partial derivatives on GPU) one could store (and render) floating point data in textures. In core OpenGL ES 2.0, there are ratified extensions GL_OES_texture_half_float and GL_OES_texture_float.
    In FireFox I can use gl.FLOAT data in gl.texImage2D()
    gl.texImage2D(gl.TEXTURE_2D, 0, gl.ALPHA, tSize, tSize, 0, gl.ALPHA, gl.FLOAT, new WebGLFloatArray(pixels));
    http://www.ibiblio.org/e-notes/webgl/tex_float.html
    but with 8-bit limited precision (i.e. 1/512 is passed as 0)
    http://www.ibiblio.org/e-notes/webgl/tex_float0.html
    How can I use 32 bit floating point textures in WebGL?

  2. #2
    Member
    Join Date
    Oct 2009
    Location
    London, UK
    Posts
    90

    Re: Floating point textures?

    As far as I understand it, they're not working right now. A lot of the shadow map implementations I've seen have worked around this by basically doing their own conversion from floats to 4-byte words and stuffing them in the RGBA channels.

  3. #3
    Junior Member
    Join Date
    Sep 2010
    Posts
    7

    Re: Floating point textures?

    Floating point textures are not part of WebGL 1.0 as they are not part of OpenGL ES 2.0 which WebGL is based on.

    But don't get too disappointed. They'll likely be added as an extension soon after 1.0 ships.

  4. #4
    Member
    Join Date
    Oct 2009
    Location
    London, UK
    Posts
    90

    Re: Floating point textures?

    Quote Originally Posted by gregg
    Floating point textures are not part of WebGL 1.0 as they are not part of OpenGL ES 2.0 which WebGL is based on.

    But don't get too disappointed. They'll likely be added as an extension soon after 1.0 ships.
    Thanks, gregg -- looks like they've been added now, and they're reported to work in Chromium nightlies.

  5. #5
    Senior Member
    Join Date
    May 2010
    Posts
    207

    Re: Floating point textures?

    I think there are still some remaining issues with float textures - they may be available, but not necessarily something you can render into.

Similar Threads

  1. Floating point precision
    By Rui in forum OpenCL
    Replies: 1
    Last Post: 03-30-2010, 10:11 AM
  2. Floating-point Constants
    By Diogo Teixeira in forum OpenKODE discussions
    Replies: 2
    Last Post: 11-30-2007, 05:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •