www.jpct.net

jPCT-AE - a 3d engine for Android => Projects => Topic started by: zbych on April 29, 2012, 08:17:41 pm

Title: Spray The Wall - simple free game
Post by: zbych on April 29, 2012, 08:17:41 pm
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 (https://play.google.com/store/apps/details?id=com.zr.spray.wall)


Title: Re: Spray The Wall - simple free game
Post by: Thomas. on April 29, 2012, 09:23:15 pm
game does not work in OpenGL v2 and also v1 on my Galaxy S... walls are grey
Title: Re: Spray The Wall - simple free game
Post by: zbych on April 29, 2012, 09:49:00 pm
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.
Title: Re: Spray The Wall - simple free game
Post by: EgonOlsen on April 30, 2012, 09:49:18 am
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.
Title: Re: Spray The Wall - simple free game
Post by: Thomas. on April 30, 2012, 10:07:41 am
In log is nothing with error...
Title: Re: Spray The Wall - simple free game
Post by: EgonOlsen on April 30, 2012, 11:12:29 am
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.
Title: Re: Spray The Wall - simple free game
Post by: zbych on April 30, 2012, 06:02:30 pm
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.
Title: Re: Spray The Wall - simple free game
Post by: EgonOlsen on May 01, 2012, 09:11:13 pm
Well, in that case...happy debugging. Stuff like texSubImage2D doesn't work too well on PowerVR devices IIRC.