Spray The Wall - simple free game

Started by zbych, April 29, 2012, 08:17:41 PM

Previous topic - Next topic

zbych

After some fight with texture managment my first game with jPCT is ready. Unfortunately I was unable to do dynamic texturing using only GLSL and render to texture, I had to stay with idea of realoading texture every time it becomes "dirty", it is bottleneck of game loop :(
The game has option to disable shaders and use GLES 1.x
Your task in this game is to paint graffiti as close as possible to given template.

https://play.google.com/store/apps/details?id=com.zr.spray.wall



Thomas.

#1
game does not work in OpenGL v2 and also v1 on my Galaxy S... walls are grey

zbych

I have tested it on Samsung Galaxy Mini, Galaxy S2, LG GT540. I have run it once on HTC but not sure what type, HTC was slowest but all those device rendered scene correctly.

EgonOlsen

Doesn't work correctly on a Nexus S either. It's all grey in both modes. I can have a look at the log output when i get back home tomorrow.

Thomas.


EgonOlsen

Not an error, but maybe some odd behaviour regarding context switches or something like that. It might help if a version with the Logger being set to debug would be available.

zbych

Odd behaviour is on my side. I know this game would cause troubles on some devices.

The problem exists because I'm not using default jPCT texture load procedure. I will explain how this game works.

Texutre image is in "system" memory where I use Context to paint with spray, when this
is done I have to load texture into graphic memory, in onDraw, before objects are drawn i call:

GLES20.glActiveTexture(GLES10.GL_TEXTURE0);
GLES20.glBindTexture(GLES10.GL_TEXTURE_2D, myTextureId);
GLUtils.texSubImage2D(GLES10.GL_TEXTURE_2D, 0, 0, 0, wallBitmap);

after this sequence I do "normal" drawing:
frameBuffer.clear();
world.renderScene(frameBuffer);
world.draw(frameBuffer);

but wall objects have set render hook, and in beforeRendering() I execute sequence:

GLES10.glActiveTexture(GLES10.GL_TEXTURE0);
GLES10.glBindTexture(GLES10.GL_TEXTURE_2D,  myTextureId);
if(_useGL20) {
  shader.setUniform("textureUnit0", 0);
  GLES10.glActiveTexture(GLES20.GL_TEXTURE1);
  GLES10.glBindTexture(GLES20.GL_TEXTURE_2D, bumpTextureId);
  shader.setUniform("textureUnit1", 1);
  GLES10.glActiveTexture(GLES10.GL_TEXTURE0);
}

It works on emulator, and on other devices when I was testing it.
I know it is unusual way to use this engine, but this is the fastest way of load texture into opengl I know so far.

EgonOlsen

Well, in that case...happy debugging. Stuff like texSubImage2D doesn't work too well on PowerVR devices IIRC.