ofFloatImage and openGL target

Hi everyone,
I encountered a problem with loading a 32 bit float image using the nightly build.

I setup the window as follows:

    ofGLWindowSettings settings;
    settings.setGLVersion(4, 5);
    ofRunApp(new ofApp());

When I load my image in the setup:

the following warning appears:
_[warning] ofGLUtils: ofGetGLInternalFormat(): float textures not supported in OpenGL ES_

I digged a little bit and it seems to me that, as in line 92 of ofGLUtils.cpp, the correct pixel type would be defined at this point:
#if not defined TARGET_OPENGLES || defined TARGET_EMSCRIPTEN

one of these two flags has been activated somewhere but as far as I’m concerned, these targets should be explicitly defined when creating the application.
Is this a bug or did I miss something?
Thanks in advance.

Hi @cwrong,
Currently float textures are only supported on OpenGL ES via Emscripten.
What platform are you targeting?

1 Like

Hello Nick. thanks for your answer.
I’m currently targeting desktop platforms (I use Windows, but other people in our studio use macOS).
In older versions of Openframeworks, we used to load 32 bit float textures to store point cloud information and then use them in shaders.
If this is not going to be supported anymore I’m sure we can find a workaround :slight_smile:
Let me know!
Thanks in advance.

Hi @cwrong,
Sorry, looking back at my answer it is lacking more information.
Float textures should be supported on desktop, including Windows, OSX and Linux. Seems like you might be using a nightly build?
The ofCubeMap class uses exr float images. Can you try compiling the materialPBR example.

Did some testing on OSX and found a work around.

string fpath = "modern_buildings_2_2k.exr";
img.load(fpath); // fails to load into ofImage, must use ofFloatImage
ofLoadImage(tex, fpath ); // fails to load into ofTexture
ofLoadImage(fpix, fpath); // succeeds in loading to ofFloatPixels
if( !tex.isAllocated() ) {
	// The texture has failed to load, so load the float pixels data
	tex.loadData( fpix );

I confirm I’m using a nightly build as I needed some new features that are not supported in the stable release. Your workaround works just fine :slight_smile:

Thank you very much!