Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 10 of 23

Thread: 16 bit float texture upload

Hybrid View

  1. #1
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421

    16 bit float texture upload

    To upload, the only way seems to be

    glTexImage2D(target, 0, GL_RGBAF16_ARB, w, h, 0, GL_RGBA, GL_HALF_FLOAT_NV, pixels);

    I`m not sure why GL_HALF_FLOAT_NV hasn`t been inserted into ARB_texture_float.
    I guess the alternative is GL_FLOAT but I`m pretty sure that means 32 bit float.
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

  2. #2
    Senior Member OpenGL Pro sqrt[-1]'s Avatar
    Join Date
    Jun 2002
    Location
    Australia
    Posts
    1,006

    Re: 16 bit float texture upload

    It would also be nice to have some GLU functions to convert from float->half and half->float.

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2008
    Posts
    1

    Re: 16 bit float texture upload

    @ V-man: Try GL_HALF_FLOAT_ARB

    @ sqrt[-1]: do you know the OpenEXR library? It provides float <-> half conversions

  4. #4
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421

    Re: 16 bit float texture upload

    I just found out about ARB_half_float_pixel which has GL_HALF_FLOAT_ARB. I don't see why they have designed it like this.
    ARB_texture_float should just offer GL_HALF_FLOAT_ARB

    or better yet,
    ARB_texture_float (for 32 bit, if GPU can do it)
    and
    ARB_texture_halffloat (if GPU can do it)

    and perhaps someday they can make
    ARB_texture_double

    PS: GLU should be updated IMO.
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

  5. #5
    Advanced Member Frequent Contributor arekkusu's Avatar
    Join Date
    Nov 2003
    Posts
    676

    Re: 16 bit float texture upload

    gluBuild*Mipmaps should support half/float.

  6. #6
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421

    Re: 16 bit float texture upload

    Quote Originally Posted by arekkusu
    gluBuild*Mipmaps should support half/float.
    No need. Mipmap generation is a requirement since a long time ago so the GL drivers can generate mipmaps.
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

  7. #7
    Intern Newbie
    Join Date
    Sep 2007
    Posts
    45

    Re: 16 bit float texture upload

    Quote Originally Posted by V-man
    I just found out about ARB_half_float_pixel which has GL_HALF_FLOAT_ARB. I don't see why they have designed it like this.
    ARB_texture_float should just offer GL_HALF_FLOAT_ARB

    or better yet,
    ARB_texture_float (for 32 bit, if GPU can do it)
    and
    ARB_texture_halffloat (if GPU can do it)

    and perhaps someday they can make
    ARB_texture_double

    PS: GLU should be updated IMO.
    The only reason i could think why they didn't include GL_HALF_FLOAT_ARB in ARB_texture_float is, Nvidia was supporting half filtering from the begining and ATI wasn't (still?), without half filtering maybe GL_HALF_FLOAT_ARB pointless?

  8. #8
    Intern Newbie
    Join Date
    Sep 2007
    Posts
    45

    Re: 16 bit float texture upload

    Quote Originally Posted by zxmvb23
    @ V-man: Try GL_HALF_FLOAT_ARB

    @ sqrt[-1]: do you know the OpenEXR library? It provides float <-> half conversions
    Nvidia and OpenEXR both use same library.
    But why would you need a conversion if you can't upload results to gpu? And if you can upload, you can convert your data to any format using shader, you wouldn't need any other extension/library/GLU function.

  9. #9
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421

    Re: 16 bit float texture upload

    Quote Originally Posted by noncopyable
    Quote Originally Posted by zxmvb23
    @ V-man: Try GL_HALF_FLOAT_ARB

    @ sqrt[-1]: do you know the OpenEXR library? It provides float <-> half conversions
    Nvidia and OpenEXR both use same library.
    But why would you need a conversion if you can't upload results to gpu? And if you can upload, you can convert your data to any format using shader, you wouldn't need any other extension/library/GLU function.
    The extension should have been properly done so that we could upload it to the GPU. This is an issue on ATI.

    I don't know what you mean by "convert your data to any format using shader"
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

  10. #10
    Intern Newbie
    Join Date
    Sep 2007
    Posts
    45

    Re: 16 bit float texture upload

    Yes, what we need is a proper support to what we have (arb_texture_float), not another library/GLU function.

    By "convert your data to any format using shader", nothing special, i just mean using a shader you can convert any format to another one, for example 32bit integer to fp16 texture, or rgbe to fp16 etc.

    I just don't like the idea of adding new functions to GLU, or new libraries like GLU, i just want a solid, standard, low level graphic language.

Posting Permissions

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