Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: 16 bit float texture upload

  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,007

    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
    Advanced Member Frequent Contributor arekkusu's Avatar
    Join Date
    Nov 2003
    Posts
    676

    Re: 16 bit float texture upload

    Quote Originally Posted by V-man
    Mipmap generation is a requirement since a long time ago so the GL drivers can generate mipmaps.
    That doesn't do me any good when I have a 20k x 20k float image to upload.

    gluScaleImage / gluBuild*Mipmaps should support half/float. So we can prepare data for GL on the CPU.

  10. #10
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,768

    Re: 16 bit float texture upload

    gluScaleImage / gluBuild*Mipmaps should support half/float. So we can prepare data for GL on the CPU.
    Not that I agree or disagree with the upgrade to GLU, but what does that have to do with GL being on the CPU? The two things seem to be rather orthogonal.

Posting Permissions

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