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.

Topics - zbych

Pages: 1 [2]
Projects / Music Ride
« on: January 19, 2013, 11:31:15 pm »
In a fact I didn't want to write next game - to much work for nothing - I prefer to write wallpapers (less work more profits), but... I like to write games, the idea was good and I thought... ok I will do it last time, and here it is: "Music Ride" - the game driven by music. The idea comes from PC game (guess the name), where track and other stuff are generated based on selected song. The analyzer routine is written in C, and compiled to three CPUs (ARM, ARMv7, x86), so if you have floating point extension in CPU you will be happy, but if you don't, and have low end device... you have to have "a lot patience my young padawan :D ". I hope you will like this project. To Egon: You can put this game to projects page if you like ;)

Projects / Virtual Photo Gallery (spot lights in jPCT)
« on: November 19, 2012, 10:23:34 pm »
Hello everyone.

I was experimenting with spot lights in GLSL & jPCT and this is small fruit of my experiments - "Virtual Photo Gallery" (wallpaper and application).
There is strange side effect of those experiments - the regular application behaves different than wallpaper service, and it looks like TextureManager is not creating a new instance (IMHO logicaly it should ;) ) when application is reCreated (onCreate was called but TextureManager has it's old data) ??? but I don't want to dig into details of my struggle.

Anyway you can download it:
Link application:

Link to wallpaper:

Support / Depth buffer error?
« on: November 05, 2012, 04:22:51 pm »
I have torus in the center of scene, when camera look at it from one side it is rendered ok, but when I move camera to other side it looks like a depth buffer error. Any advice how to avoid this kind of problem, is any cure for this?

Support / Light diffuse colors in fragment shader
« on: October 31, 2012, 04:58:59 pm »
I wanted to add to my shader diffuse colors for lights. Everything was fine on Samsung Galaxy S2, but on lower devices like LG-GT540 or Samsung Galaxy Mini it looks like I got zeros in diffuseColors array ??? What might be cause of this behavior? I can pass color for light in my own uniforms but I wanted to use existing ones.

Support / Stationary spot light - how to?
« on: October 29, 2012, 08:40:20 pm »
I am trying to create stationary spot light, but so far I am stuck - shaders aren't my best side. I have created desired effect but only on objects which don't have any transformation. What I am doing wrong? I was trying diffrent combinations for transformed objects but in all cases the light was "moving" when I changed camera position. For simplicity I have removed attenuation (it is set to 1.0).

Code: [Select]
void main(void)
vec4 normal4 = vec4(normal, 0);
vec4 position4 = modelViewMatrix * position;
vec3 position3 = / position4.w;

vec4 eyeNormal4 = modelViewMatrix * normal4;
varNormal =;

varLightDir[0] = normalize(lightPositions[0] - position3);
varSpotDir[0] = normalize((modelViewMatrix * vec4(lightSpotDir0,0)).xyz);
varLightDist[0] = length(lightPositions[0] - position3 );

texCoord = texture0;
gl_Position = modelViewProjectionMatrix * position;

Code: [Select]
void main (void)
vec4 finalColor;
float spotAngle;
vec3 n = normalize(varNormal);
vec3 normalLightDir;
float diff;
float att;

vec4 base = texture2D(textureUnit0, texCoord);
finalColor = base * ambientColor;
normalLightDir = normalize(varLightDir[0]);
diff = max(0.0, dot(n, normalLightDir));
if(diff > 0.0)
spotAngle = dot(normalize(-varSpotDir[0]), normalLightDir);
if(spotAngle > 0.75)  //spot cut off
spotAngle = pow(spotAngle, 12.0);
//att = spotAngle / (0.6 + 0.001 * tempDistance + 0.1 * tempDistance * tempDistance );
att= 1.0;
finalColor += (base) * diff * att ;

finalColor.a = alpha;
gl_FragColor = finalColor;

Bugs / Set uniform with SimpleVector
« on: October 18, 2012, 09:08:22 pm »
When I am trying to set uniform with setUniform(String, SimpleVector) I get error, but setting the same with float[] works ok. Uniform variable is vec3 type.
It's not big problem for me to use float arrays but maybe I done something wrong. I presume array version is faster than SimpleVector.

10-18 20:49:57.446: E/AndroidRuntime(11941): FATAL EXCEPTION: GLThread 8991
10-18 20:49:57.446: E/AndroidRuntime(11941): java.lang.NullPointerException
10-18 20:49:57.446: E/AndroidRuntime(11941):    at com.threed.jpct.GLSLShader.update(
10-18 20:49:57.446: E/AndroidRuntime(11941):    at com.threed.jpct.GL20.updateShaderData(
10-18 20:49:57.446: E/AndroidRuntime(11941):    at com.threed.jpct.GLRenderer.initShader(
10-18 20:49:57.446: E/AndroidRuntime(11941):    at com.threed.jpct.CompiledInstance.render(
10-18 20:49:57.446: E/AndroidRuntime(11941):    at com.threed.jpct.GLRenderer.drawVertexArray(
10-18 20:49:57.446: E/AndroidRuntime(11941):    at com.threed.jpct.World.draw(
10-18 20:49:57.446: E/AndroidRuntime(11941):    at com.threed.jpct.World.draw(
10-18 20:49:57.446: E/AndroidRuntime(11941):    at com.zr.tile3d.MainActivity.onDrawFrame(
10-18 20:49:57.446: E/AndroidRuntime(11941):    at android.opengl.GLSurfaceView$GLThread.guardedRun(
10-18 20:49:57.446: E/AndroidRuntime(11941):    at android.opengl.GLSurfaceView$

Projects / Escape From Creepy Lab
« on: October 06, 2012, 12:51:16 am »
Hi everyone.
I want to present my another production oldschool-type arcade platformer - in fact it is 2D game presented with 3D graphics.  It does not contain advanced fx, shaders etc., just simple models and some skeletal animations. The idea to write this game comes from old game for C64. I thought it would be nice to play this game again, but without joystick as controller (screen joystick usualy is not a good idea) and with 3D graphics... and here it is: "Escape From Creepy Lab".

Bones / How to change visibility of AnimatedGroup?
« on: July 28, 2012, 04:44:03 pm »

I was try to change visibility of AnimatedGroup with something like this:

Code: [Select]
but it is not working. How can I change the visiblitiy of animated group? I can remove it from world but in that case I have to give lower level objects access to World object.

Support / A lot of errors EGL_BAD_ALLOC ?
« on: June 04, 2012, 10:33:09 pm »

I'm getting a lot of error reports of this type from users running my game. Is here someone with idea what causes it, or is it possible to avoid it?

java.lang.RuntimeException: eglSwapBuffers failed: EGL_BAD_ALLOC
at android.opengl.GLSurfaceView$EglHelper.throwEglException(
at android.opengl.GLSurfaceView$EglHelper.swap(
at android.opengl.GLSurfaceView$GLThread.guardedRun(
at android.opengl.GLSurfaceView$

Projects / 3D Landscape - wallpaper
« on: May 25, 2012, 12:18:12 am »
This time I want to present live wallpaper. It generates simple landscape model (diamond square algorithm), and animate camera over it. No shaders, just one light, two textures (both generated with diamond square), and fog.
I am starting to think how to use it in game... ;)

You can download it here:

It uses Airpush (as all of my wallpapers).

Projects / Spray The Wall - simple free game
« 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.

Projects / 3D Live Wallpaper using GLSL
« on: February 22, 2012, 09:24:03 am »
It's my first project using jPCT. I have written it for Valentine's day and it's my first OpengGL app with GLSL. I know Valentine's is behind us :) but  I wanted to say that the possibility to use shaders in jPCT is great thing.
On some devices there might be "Create context error", but I am unable to find the reason of this.

Support / Dynamic texture - setRenderTarget
« on: February 17, 2012, 09:57:44 pm »
I wanted to write an application that uses a dynamically changing textures - just need to copy the contents of one texture to another in the desired location.
I tried to use the opportunity to render to texture, but I found a problem. I do not know whether it is normal for OpenGL ES, but the problem is that during the next call
onDrawFrame the framebuffer holding dynamic texture contains garbage and is useless without clearing and re-rendering it again, but I need to keep the contents of this texture and draw another items on it. I tested it on three devices and only on one of them texture has not been littered between subsequent calls onDrawFrame.

Is any solution to this, or other way to generate dynamic textures without having to load them into GPU memory?

Pages: 1 [2]