OpenGL ES framebuffer issues - Android

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
eye776
Posts: 94
Joined: Sun Dec 28, 2008 11:07 pm

OpenGL ES framebuffer issues - Android

Post by eye776 »

I have some trouble porting a small game I made with irrlicht under Windows (irrlicht 1.7.3-official compatible) to the OpenGL ES driver (ES 1.1). There's a RTT (a framebuffer) used to draw certain effects (mostly metaball particles and water).

The phone I'm testing on supports framebuffers, but only some effects appear to be rendered (but not the particles).
Also, everything drawn "under" the framebuffer sometimes randomly doubles in size for a few frames.

DrawEffectsToFB()
DrawGameBGToScreen()
DrawGameObjectsToScreen()
DrawFBToScreen()

Everything looks OK under the PVR ES emulator (under windows).
I don't have screenshots on me, but I'll post some as soon as I get to my PC.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: OpenGL ES framebuffer issues - Android

Post by hybrid »

Not sure if RTT support is available under ogl-es 1.x. The fbo extensions are probably missing, and the rtt based on framebuffer readback could have some restrictions. I also tested on the emulator only most of the time, so not sure about the actual limitations of devices.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: OpenGL ES framebuffer issues - Android

Post by Nadro »

OGL ES1.1 doesn't support FBO (just via extansions on some GPU models but IDK how it works in practice). If you need RTT you should switch to OGL ES2 driver (it should be ready soon).
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
eye776
Posts: 94
Joined: Sun Dec 28, 2008 11:07 pm

Re: OpenGL ES framebuffer issues - Android

Post by eye776 »

It would probably take a while to switch to OGL ES 2 so I'd rather stick to 1.1 for this project.
Besides apart from really old handsets (G1, Hero, maybe Droid - the first one) pretty much everything out there has
GL_OES_framebuffer_object support.

Anyway, I managed to get it to work (somewhat). Turns out it was somewhat counterintuitive:
1) COGLES1Driver used COGLES1Texture* instead of COGLES1FBOTexture* regardless of GL_OES_framebuffer_object support.
2) COGLES1FBOTexture* was created with different values for InternalFormat and PixelFormat. This made it fail silently (checked with checkFBOStatus).
3) After COGLES1FBOTexture::bindRTT() the viewport was never set, so nothing was ever rendered.

Why do I say "somewhat"? Well, drawing to the FBO using COGLES1Driver::drawVertexPrimitiveList works just as expected, but using
COGLES1Driver::draw2DVertexPrimitiveList draws everything with an offset (probably because of bad transforms).

FBO with drawVertexPrimitiveList
Image

FBO with draw2DVertexPrimitiveList
Image
Post Reply