Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Lobby

Pages: [1] 2 3 ... 5
Projects / Re: TheoTown
« on: December 21, 2015, 12:47:04 pm »

Thank you, Egon.

Is there any chance to improve blitting performance? Another thing is that uniforms applied to a blitting shader seem to be ignored because blits are drawn batched so just the last set values will be used for one batch.

Projects / Re: TheoTown
« on: August 25, 2015, 09:59:12 am »
It has a heap size of 16 MB ;D

ETC doesn't help because it needs for a short time even more memory than without it (I guess it's because of the compressing process). I think it would be needed here to upload just parts of the texture so that the whole image never has to be stored within the VM heap.

Projects / Re: TheoTown
« on: August 24, 2015, 08:08:23 pm »
Thank you :)

I use a huge 2048x2048 texture which contains all the graphics (so it's a texture atlas). Textual plugins then define the coordinates of single frames. I experimented on other solutions but the texture atlas seems to be the fastest for drawing.

This is the texture with a scaling of 25%:

A problem are old devices with a too small VM stack. They can't run the game, even if the texture size is supported.

Projects / TheoTown
« on: August 24, 2015, 11:24:05 am »

I wrote a 2d city simulation game using jPCT as blitting engine. It's still in alpha phase but I'm working on it :)

Google Play:


Support / Re: Shader for blitting
« on: April 26, 2015, 12:52:23 pm »
Yeah, that's often used for 2d, but it's anything else than trivial :( .

Support / Re: Shader for blitting
« on: April 25, 2015, 03:40:46 pm »
You're right there. Performance tests revealed that blitting is much faster than using 3D objects instead.

Support / Re: Shader for blitting
« on: April 24, 2015, 11:29:31 pm »
Thank you, seems to work for me. Here a test where I just desaturate a game:

I used the shaders as following.

Code: [Select]
uniform mat4 modelViewMatrix;
uniform mat4 modelViewProjectionMatrix;
uniform mat4 textureMatrix;

uniform vec4 additionalColor;
uniform vec4 ambientColor;

uniform float alpha;

uniform bool useColors;

attribute vec4 position;
attribute vec4 color;
attribute vec2 texture0;

varying vec2 texCoord;
varying vec4 vertexColor;

void main() {

texCoord = (textureMatrix * vec4(texture0, 0, 1)).xy;

vec4 vertexPos = modelViewMatrix * position;
vertexColor = ambientColor + additionalColor;

vertexColor=vec4(min(vec3(1), *, alpha);

gl_Position = modelViewProjectionMatrix * position;

Code: [Select]
precision mediump float;

uniform sampler2D textureUnit0;

varying vec2 texCoord;
varying vec4 vertexColor;

void main() {
vec4 col = texture2D(textureUnit0, texCoord) * vertexColor;

    float grey = 0.3 * col.r + 0.6 * col.g + 0.1 * col.b;

col = vec4(vec3(grey), col.a);


Which shader code is used for blitting by default? Maybe you can also provide it's source if it contains some useful optimizations.

Z-Testing in this context means that one can set a depth value for each blit and only fragments with smaller depth value should be drawn. I could need this to solve some issues with drawing the cars. I always have to draw them in the right order now to avoid wrong overlapping.

Support / Re: Shader for blitting
« on: April 18, 2015, 06:51:42 pm »
Hey Egon, did you forget it?  ;D

Another thing: May it possible to use z-Testing for blitting?

Support / Re: Shader for blitting
« on: April 08, 2015, 03:59:36 pm »
I hadn't something special in mind. Just thought it would be really useful to render some effects without 3d objects.

Support / Shader for blitting
« on: April 06, 2015, 10:35:51 am »
Hello, is there a way to set an own shader for blitting?

Support / Re: Object3D's transparency issue
« on: January 05, 2015, 03:35:24 pm »
I can't open the image :( .

Support / Re: Question about transparency
« on: January 05, 2015, 11:21:44 am »
B behind the A  and C behind the B,   but it seems   b and c  can see  through A .  It maybe the Z-Order problem.

Yes, that sounds like the z-ordering problem on transparent objects. See this topic for more information. I also provide there a sample with a costum shader to solve the problem using alpha testing (which just means that fully transparent texels won't be drawn).

Support / Re: Question about transparency
« on: January 04, 2015, 09:58:41 am »
In order to load a texture with alpha channel you have to use a Texture constructor where you specify the useAlpha parameter with true. Otherwise the transparency won't be loaded. A setTransparency(15) should then be enough to see the changes. Be aware that you may get problems with the drawing order when using transparency like this.

Here I would recommend instead a own shader which just doesn't draw one specific color (like black). This also would solve the Z-Order problem.

Support / Re: Object3D's transparency issue
« on: January 03, 2015, 01:54:34 pm »
Indeed it will ;) . Alpha testing is also used in minecraft btw.

Support / Re: Object3D's transparency issue
« on: January 03, 2015, 11:38:57 am »
Maybe you should make sure that you call setTransparency(-1) on your objects so they will use the Z-buffer correctly.

Pages: [1] 2 3 ... 5