Render to texture with EGL (pandagles2)

I’m trying to render to texture, but after calling graphicsEngine.renderFrame() I got

libEGL warning: FIXME: egl/x11 doesn’t support front buffer rendering

Does it mean that EGL/GLES2 pipeline doesn’t support rendering to texture at all? My ultimate goal is to modify Panda3D slightly to be able to render in headless mode, without X11.

I don’t think it means that; I just think it means that rendering to the front buffer is not allowed. I don’t think this should affect render-to-texture.

I think the article is referring to using EGL with OpenGL (instead of GLES), which is not currently supported in Panda, but it would not be too hard to change Panda to do this.

Actually I firgure out that message came from libEGL directly and had nothing to do with Panda3D. The solution was to run the program on NVidia GPU, because Intel HD GPU driver has limited support of EGL.

Could you please provide any recommendation regarding the best way to implement my idea? I took a look at eglGraphicsPipe, but it inherits from x11GraphicsPipe which makes it impossible to use EGL alone without X11. Should I make my own pipe and/or gsg then or is there a way to compose a new display type (similar to pandagl and pandagles2) out of existing classes?

Panda’s graphics API has a bit of an awkward design issue right now: there can be a many-to-many association between windowing APIs and graphics interface APIs, but Panda’s current inheritance model only allows for a many-to-one association here, due to the need to inherit from x11GraphicsPipe or similar. We intend to fix this in the longer term.

In the meantime, since you don’t need to open any on-screen windows, and you’re willing to compile Panda from source, I think the easiest thing for you to do would be to make it possible to compile egldisplay without X11. This means that if HAVE_X11 is not set, it would not inherit from x11GraphicsPipe, but straight from GraphicsPipe. It would furthermore not compile the code in eglGraphicsWindow.h/.cxx nor offer to create an eglGraphicsWindow in eglGraphicsPipe::make_output().

I would be quite happy to entertain a patch to this effect. I think this approach would not require many changes.

If you wish to use desktop OpenGL instead of OpenGL ES with EGL, as described in the NV article, you would additionally need to make it possible to compile egldisplay against the regular OpenGL API. This would not be much different from the current mechanism by which it switches between OpenGL ES 1 and OpenGL ES 2 at compile time.

Great, thank you! I will now try.

This would not be much different from the current mechanism by which it switches between OpenGL ES 1 and OpenGL ES 2 at compile time.

Do you mean via #ifdef?

Great, let me know if you have any questions.

Yes, via #ifdef indeed.