loading 32-bit EXR to use as a texture

Hey guys,

I’m trying to load a 32-bit EXR image into an ofImage object so that I can access the pixels in an ofTexture.

I started hacking it into ofImage and can see that the image is being loaded, the total bits being 128 (32 * RGBA). It seems like it’s being loaded ok, I’m just not sure of what to do once it is, or if the bytes are in the proper order, etc…

FreeImage supports the EXR file format, so I’m hoping it’s fairly trivlal :smiley:

Anyone have experience with this?


have you tried to just draw it?

ofImage will convert the pixels to 24bpp so 8bits per channel 3 channels when it’s in a non supported format, you will not get the pixels as floats but you should be able to draw it and access them as unsigned char rgb

Thanks for the reply, Arturo!

I should have mentioned that I’m using the exr for float values to get a better value range.

I tried drawing an exr loaded into ofImage and it won’t display properly for me. I’m more concerned with getting the floating point values versus something that I can display easily on-screen as I’m painting them into a floating point fbo to create a heightmap with good precision and then turning this into a normal map.

Maybe I should just load the image with openEXR library as it comes in as a format that can be used directly in an OpenGL texture?

actually freeimage has support for exr and float images but ofImage doesn’t we’ve been talking about supporting this for the next release but it’s not there yet, so if it’s easy for you to use openexr go for it.