EGLWindow::copyContentsToMemory

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
User avatar
c6burns
Beholder
Posts: 1511
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines

EGLWindow::copyContentsToMemory

Postby c6burns » Fri Mar 06, 2015 10:03 am

Code: Select all

mRenderWindow->copyContentsToMemory(pb);

When I call this in Android, this gives me back a PixelBox full of 0s ... all black. I think it's because in EGLWindow::copyContentsToMemory we are calling glReadPixels with format GL_RGB. With any format other than GL_RGBA it results in GL_INVALID_OPERATION and so it never touched the PixelBox's data. Forcing the format to GL_RGBA does fix the issue, but methods like RenderTarget::writeContentsToFile are always going to pass down a PixelBox with PixelFormat PF_BYTE_RGB when called from a RenderWindow because of suggestPixelFormat being overridden.

I just hacked my version so it works, but I'm a bit lost on how this could be patched properly. Maybe it's as simple as overriding suggestPixelFormat from EGLWindow, assuming this issue affects all GLES2 devices, or AndroidEGLWindow if it's Android specific? ... I'll do some more testing
0 x

arkeon
Goblin
Posts: 254
Joined: Fri Dec 04, 2009 6:02 pm

Re: EGLWindow::copyContentsToMemory

Postby arkeon » Sun Apr 17, 2016 2:41 pm

Just got the same issue on Android with Ogre 1.10 ^^

Do you have more infos on this ?
Or should I just make my own writeContentsToFile function for android and set the correct pixel format ?
0 x
OpenSpace 3D Project manager
http://www.openspace3d.com

User avatar
c6burns
Beholder
Posts: 1511
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines

Re: EGLWindow::copyContentsToMemory

Postby c6burns » Sun Apr 17, 2016 10:54 pm

I was working with this function to render down videos of level playthroughs on-the-fly. There are better methods for gles3 than what Ogre has implemented, but I still didn't have a chance to test this on iOS because I probably won't implement this feature in the end. Anyway I don't think I ever submitted a PR because I was going to wait and see if I had to patch all of gles2 or just android.

Anyway long story short, just patch your suggestPixelFormat (in either EGLWindow or AndroidEGLWindow, your call) to return the correct pixel format.
0 x

arkeon
Goblin
Posts: 254
Joined: Fri Dec 04, 2009 6:02 pm

Re: EGLWindow::copyContentsToMemory

Postby arkeon » Sun Apr 17, 2016 10:58 pm

ok thanks.

yes I just implemented the same code from copyContentsToMemory and changed the pixel format. So it's working for now on android.
I'll check this on IOS once I got my things working on it.
0 x
OpenSpace 3D Project manager
http://www.openspace3d.com


Return to “Mobile Devices”

Who is online

Users browsing this forum: Baidu [Spider] and 3 guests