Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Can I extract the hex value from a sampler2D?

  1. #1
    Intern Newbie
    Join Date
    Feb 2011
    New Zealand

    Can I extract the hex value from a sampler2D?

    I am wanting to push quite a bit of floating point data through to the shader to handle lighting/shadowing. Initially I thought of using uniform structures and arrays but I suspect I will exceed quota allowable for uniforms so have opted for textures as a place to push through these floating point arrays. Rather than using floating point format images (unless someone knows how to construct these on the fly using SDL2) I was thinking of converting the floats to hex and shoving the hex into the rgba. Is it possible to read hex values directly from textures? Or does someone have the conversion rgba to hex to float? Cheers.

  2. #2
    Senior Member OpenGL Lord
    Join Date
    May 2009
    There is no such thing as a "hex value". There are integers and there are floating-point numbers.

    There are integral image formats. These are only available on GL 3.0+ capable hardware. Uploading the data must be done with a special pixel format.

Tags for this Thread

Posting Permissions

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