multi texture objects & Texture.keepPixelData(..)

Started by raft, August 10, 2010, 02:32:54 PM

Previous topic - Next topic

raft

say, i have multi texture object, for example a merged one. when GL surface is recreated textures are gone. in order to restore the object's state, calling Texture.keepPixelData(true) is the only way, right? otherwise, i can't load textures again and call setTexture on the object, because it's a multi texture object.

EgonOlsen

Or create/load everything from scratch...or simply exit the game on pause and stop, which is what i'm going to do... ;D

raft

the ability to pause the game seems valuable to me. for example when a call arrives. but cost a bit memory.

EgonOlsen

It has another drawback as well: Vertex arrays are save, but VBOs are bound to the gl context. If that changes, the code that renders the geometry will detect that (hopefully) and revert to plain vertex arrays (there should be a log message telling so). At least the current version can't recover back to use VBOs after destroying the gl context.

EgonOlsen

Quote from: EgonOlsen on August 10, 2010, 03:06:46 PM
It has another drawback as well: Vertex arrays are save, but VBOs are bound to the gl context. If that changes, the code that renders the geometry will detect that (hopefully) and revert to plain vertex arrays (there should be a log message telling so). At least the current version can't recover back to use VBOs after destroying the gl context.
I've uploaded a jar that might be able to handle this...i'm not sure, i have no test case...

raft


raft

Quote from: EgonOlsen on August 10, 2010, 04:54:14 PM
I've uploaded a jar that might be able to handle this...i'm not sure, i have no test case...

what should i look for in logs? it seems to work ok. at least there is no problem. the surface gets recreated and everything seems in place.

note: on my phone, a certain way to get surface recreated is to make phone sleep and wake up again


EgonOlsen

It should read something like "context changed...trying to recover" or similar. But that only happens if VBOs are enabled in Config anyway.

raft

well, it tries to recover but never finishes it. recreates VBO's for same objects again and again..

I/jPCT-AE (14505): [ 1281529704748 ] - WARNING: OpenGL context has changed...trying to recover...
I/jPCT-AE (14505): VBO created for object 'object4'
I/jPCT-AE (14505): [ 1281529704765 ] - WARNING: OpenGL context has changed...trying to recover...
I/jPCT-AE (14505): VBO created for object 'object4'
I/jPCT-AE (14505): [ 1281529704780 ] - WARNING: OpenGL context has changed...trying to recover...
I/jPCT-AE (14505): VBO created for object 'GeoSphere0_jPCT3'
I/jPCT-AE (14505): [ 1281529704794 ] - WARNING: OpenGL context has changed...trying to recover...
I/jPCT-AE (14505): VBO created for object 'object6'
I/jPCT-AE (14505): [ 1281529704822 ] - WARNING: OpenGL context has changed...trying to recover...
I/jPCT-AE (14505): VBO created for object 'object4'
I/jPCT-AE (14505): [ 1281529704855 ] - WARNING: OpenGL context has changed...trying to recover...
I/jPCT-AE (14505): VBO created for object 'object4'
...

EgonOlsen

I must have done something stupid then...i'll look at it.

raft

about the comment in javadoc for Config.useVBO
QuoteMakes the engine use vertex buffer objects if possible instead of plain vertex arrays. This may be faster on some hardware. On Samsung Galaxy, it isn't and i can't help but think that causes a crash now and then...which is why it defaults to false.

i didn't noticed any performance difference on N1 neither any crashes. indeed, on N1 i never experienced a crash in native code. on G1 it was happening quite often

EgonOlsen

Quote from: raft on August 11, 2010, 03:19:22 PM
about the comment in javadoc for Config.useVBO
QuoteMakes the engine use vertex buffer objects if possible instead of plain vertex arrays. This may be faster on some hardware. On Samsung Galaxy, it isn't and i can't help but think that causes a crash now and then...which is why it defaults to false.

i didn't noticed any performance difference on N1 neither any crashes. indeed, on N1 i never experienced a crash in native code. on G1 it was happening quite often
I've uploaded a new jar which fixes at least some of the stupid things that i made when trying to recover. Please give it a try.
About the VBO stuff: It actually is faster on N1 at least when judging from the numbers that An3DBench returns. However, it's not used for animated objects or objects with an IVertexController attached anyway, because the VBO simply doesn't update even when created with GL11.GL_DYNAMIC_DRAW...at least not on my phone.

raft

it still reports a few recovers for same object but does not last forever. maybe that recovers are for different compiled instances ? other than that everything seems fine ;D thanks..

EgonOlsen

Can you post the log output, please? It might be fine, i just want to be sure...

raft

I/jPCT-AE (14867): [ 1281554470189 ] - WARNING: OpenGL context has changed...trying to recover...
I/jPCT-AE (14867): VBO created for object 'object11'
I/jPCT-AE (14867): [ 1281554470282 ] - WARNING: OpenGL context has changed...trying to recover...
I/jPCT-AE (14867): VBO created for object 'object11'
I/jPCT-AE (14867): [ 1281554470288 ] - WARNING: OpenGL context has changed...trying to recover...
I/jPCT-AE (14867): VBO created for object 'object11'
I/jPCT-AE (14867): [ 1281554470311 ] - WARNING: OpenGL context has changed...trying to recover...
I/jPCT-AE (14867): VBO created for object 'GeoSphere0_jPCT10'
I/jPCT-AE (14867): [ 1281554470332 ] - WARNING: OpenGL context has changed...trying to recover...
I/jPCT-AE (14867): VBO created for object 'object13'