RenderToTexture fails to work on machines with OpenGL 2.1

Hi,

I m working on a framework that features render to texture and post-processing effects in OpenFL 2.2.8 native v2. My program works on machines with OpenGL version 4.4 and 3.3, but when I try it on a machine with OpenGL 2.1, the program stops working. https://github.com/bmfs/glslTest_openfl this program also stops working on the said machine while it runs fine on newer ones.

After some research I found out that FBOs are not core in OpenGL version 2.1, but when I go to http://glslsandbox.com/ the shaders run just fine (I can see in their gitHub code they used FBOs). The WebGL version support on this machine is 1.0. Is there anything I need to know to solve this problem?

Thanks a lot.

Does it require an extension to work in 2.1? Do we need to do something to enable that?

Yes I believe that an extension is needed for FBO to work in 2.1. I am not an expert in OpenGL so I can’t add it into lime myself… http://prideout.net/archive/bloom/ this tutorial uses OpenGL 2.0 and it has EXT suffixes on framebuffer related functions and stuffs.

Will this be something to come in newer versions of OpenFL 3.0? If I guessed it right, the new BitmapData filter uses GPU which I think has something to with FBO, since you are using OpenGL for GPU shaders. Therefore this compatibility issue might affect the newer versions as well @singmajesty

I think we just need to do something to load the extensions (or use them) in the Lime OpenGL layer in C++

Sounds simple enough, any instructions for me to edit the lime library?

If you have not built Lime from source, try looking at the README on https://github.com/openfl/lime for build steps (pretty simple)

In the newer code, it uses these C++ files when binding to OpenGL:

I think the solution would be detecting if the system does not have FBO support in GL, but does have an extension. I’m not sure if it would require just loading the extension, or using a different reference than the standard GL function calls, in order to use them

One of the strange thing is, using WebGL on the said computer, GL.createFrameBuffer() works just fine, without using extensions. Does WebGL include the extension detection and everything and deal with it automatically? cuz this does not make sense…

https://github.com/openfl/lime/blob/master/legacy/project/src/opengl/OGL.h

also I can see that the EXTs are being dealt with on line 46-61. Then why does render to texture not work? confused

Are you on a Mac right now?

Wait, I’m not. Oops. Still, is it possible for it to have FBO functional on WebGL but not supported on native OpenGL?

Is the issue on WebGL, or on the desktop?

On the desktop. Initializing FBO causes the program to crash. But on WebGL it’s all fine.

if you are on Windows chances are that the browsers are using ANGLE for openGL compatibility with old hardware / buggy drivers. OpenFL might use it too in the future.

Bravo, problem solved. Chrome is indeed using ANGLE. Thanks a lot :stuck_out_tongue:


This thread mentioned including ANGLE library for SDL and rebuilding lime. I would say the steps will be very simple if you want to add this feature into newer versions of OpenFL. Can’t wait! :smiley: