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 - lawless_c

Pages: [1] 2
Projects / Ireland from space live wallpaper
« on: October 24, 2016, 01:52:57 pm »
Made this live wallpaper here:

If anyone here would like to try it here are some codes  :) , some feed back would be great so i can be sure it
works on devices i could only emulate.  For the moment it doesn't work on tablets.


Support / Correctly killing an application
« on: October 05, 2016, 01:23:48 pm »
Is there anything JPCT specific that needs to be done when closing/killing an application.

I'm trying out doing a livewallpaper but i'm finding if the wallpaper activity has already been launched once for example in preview mode then the next time i try to launch preview mode or set it as a wallpaper the application seems to hang and i'm left with just a black background.

However if i reset my phone the wallpaper will then switch on correctly.

Support / rotations in jpct
« on: October 03, 2016, 01:07:35 am »
How do functions like rotations in JPCT work for example rotateAxis? does it use Radians or a regular angle?
and does it rotate in a clockwise or anti clockwise direction?

Support / sharing textures accross multiple object3d's
« on: June 30, 2016, 05:45:49 pm »
Are there any delays or locks in sending a framebuffer image to texture?

I'm trying to reuse the same texture across two object3d's , the texture is shared to both via Two texture info's

When i run this however , textureA isn't applied to objectB as it should be. Is it possible there is delay in the first render that locks  the texture? I found that if i reversed the order
i ran into the same issue but with the other object3d.



Support / Texture switching
« on: June 03, 2016, 06:24:54 pm »
Is it possible to swap texture name assignments and texture info's while running a game?

eg assign like this

TextureManager m;
Texture tex1;
Texture tex2;

m.addTexture( "textureA ", tex1) ;
m.addTexture( "textureB", tex2) ;

//Then swap them ?

m.addTexture( "textureA", tex2) ;
m.addTexture( "textureB", tex1) ;

Maybe with a 3rd texture as temporary holder.

Support / Dummy/child object3d
« on: May 13, 2016, 04:43:25 pm »
Just wanted to know, can i use child dummy object3d's   for attaching things to my entities
for example Turrets or particle emmiters that need to appear as if they are stuck to the surface of another model and rotate/move with it.

Support / How to set a blit shader?
« on: March 09, 2016, 02:08:06 am »
How and where should a shader be set for blitting?

I'm using a shader with fb.setBlittingShader but it get's ignored?

I'm trying to do this on an android device.

I'm trying to do a filtering effect kind of like this but it seems to just be ignored.

Support / Set a texture info to a blitter
« on: February 06, 2016, 01:02:10 am »
Is there any way to set a texture info to fb.blit?

I was looking at this thread here,4355.msg30380.html#msg30380

And thinking it would be great if i could also access a textureUnit1..3 as well as textureUnit0.

Support / Objects multiple worlds?
« on: October 12, 2015, 06:06:29 pm »
Is it possible to add the same instances of an Object3d to many worlds?

Would there be disposal or other issues?

I'm thinking of creating a another World object in which objects are added and the results are used to create a glowing effect.

If i could get these objects in the other world instance to use a different shader that would be even better. Maybe if i used the render-hook to switch them.
I could then use some combination of additive blending to overlay the result on the frame-buffer.

Support / Screen size/shape & view area?
« on: August 15, 2015, 08:45:17 pm »
Just wanted to know does the size of a screen affect the area the Camera sees?

For example , if i have world which contains multiple objects will a large screen running the same code as a device with a smaller screen simply show me a larger image?
or would a larger screen show everything exactly the same but larger?

I ask because im working on Some UI elements which exist in the world space(instead of being added to the framebuffer) and i wanted to know how difficult it would be to keep them im roughly similar positions accross devices.

Support / Unusual reproducible bug with shaders glsl
« on: July 28, 2015, 01:58:32 am »
I've managed to produce a bug using glsl which will function for the Object3d it is applied to but cause errors elsewhere in the program.

For context i was using a lighting shader i found elsewhere

I modified it to work with glsl in jpct.
While using the version i created i made a call at the start of the fragment shader to

Code: [Select]
uniform [b]vec4[/b] specularColors[8];
Obviously i was going outside the Jpct spec you have here:
Which says it should be a vec3.

If you use it the shader still works seemingly perfectly, and the object3d looks how i want it to.
However i've found it breaks another part the  program.

I was using Andre Silva's particle system which worked perfectly until i tried using the new seemingly unrelated shader.
It would successfully generate the first particle sprite but then crash as it attempts to generate a second particle from the same texture.

Producing this vague error  ": - ERROR: before: glError 1282"

Somehow using a vec4 instead of a vec3 causes this.

If it helps here are the shaders

The vertex shader

Code: [Select]
precision mediump float;

uniform mat4 modelViewMatrix;
uniform mat4 modelViewProjectionMatrix;
attribute vec4 position;
attribute vec3 normal;

varying float fogthickness;
varying vec3 norm;
varying vec4 eye;

void main() {

     vec3 n = normalize(modelViewMatrix * vec4(normal, 0.0)).xyz;

     norm = n;
     eye= -modelViewMatrix[3];

     fogthickness = 1.0-     dot(normalize(,n );

     gl_Position =  modelViewProjectionMatrix *position; //* vec4(position,1.0);

The fragment shader which causes the bug.

Code: [Select]

precision mediump float;

uniform vec3 atmosphereColour;

uniform vec4 specularColors[8];

uniform vec3 lightPositions[8];

varying vec3 norm;
varying vec4 eye;
varying float fogthickness;

void main() {

    vec4 spec = vec4(0.0);

        // normalize both input vectors
        vec3 n = normalize(norm);
        vec3 e = normalize(vec3(eye));
        vec3 ligthDirection = normalize(lightPositions[0]);

        float intensity = max(dot( n,ligthDirection), 0.0);
        float shininess= 1.0;

        // if the vertex is lit compute the specular color
        if (intensity > 0.0) {
            // compute the half vector
            vec3 h = normalize(ligthDirection + e);
            // compute the specular term into spec
            float intSpec = max(dot(h,n), 0.0);
            spec = specularColors[0] * pow(intSpec,shininess);
      vec4  colorout = max(intensity *  vec4(atmosphereColour,1) + spec, vec4(0.0));

    gl_FragColor = vec4( , fogthickness);

I have a hypothesis that it's because the shader will compile perfectly but when it's run only receives vec3 specularColor from Jpct itself when it expects a vec4.

Support / shaders and OnResume()
« on: July 24, 2015, 01:13:15 am »
I've been having a problem for a while now with glsl shaders and OnResume().
Upon leaving my app to check something else i found the shaders would lose certain important data such as a colour value , what i would end up with
are shaders that instead of fading to the colour i wanted simply faded to black.

Simple fix i found was to use setUniform instead of setStaticUniform in my renderhooks.

Just thought i would let you all know as i was only able mention of similar problems involving textures and onresume but not shaders.

Support / Ray picking (im doing something wrong but im not sure what)
« on: June 23, 2015, 03:00:53 pm »
I'm trying to do ray picking, partially on my own as i don't intend to use "minCalDistance" or Object3d's directly

However it only seems to partially work. I can hit objects i tap but the collision does not occur exactly at the point i picked. but seems to be offset vertically.

Code: [Select]
public static SimpleVector[] touch(MotionEvent e,FrameBuffer fb) {

     int x = (int)e.getX();
     int y = (int)e.getY();

             SimpleVector raydirection = Interact2D.reproject2D3DWS(camera, fb, x, y).normalize();
              SimpleVector cameraposition= new SimpleVector(camera.getPosition());

             return sphereIntersect(cameraPosition, ray,object_positions,objectradius);


My sphere intersection function

Code: [Select]
public static SimpleVector[] sphereIntersect(SimpleVector rayOrigin,SimpleVector rayDirection, SimpleVector sphereOrigin, float sphereRadius )


        double c = (double) sphereOrigin.length();
        double v = (double) sphereOrigin.calcDot(rayDirection);
        double d = sphereRadius * sphereRadius - (c * c - v * v);

        if (d < 0.0) {
            return new SimpleVector[0];
        float distance = (float) (v - Math.sqrt(d));
        SimpleVector r1 = new SimpleVector(rayDirection.calcAdd(rayOrigin));

        return new SimpleVector[]{r1};

Perhaps it's an issue with how android handles screen coordinates?

Support / Are object3d s centered?
« on: June 10, 2015, 03:17:54 pm »
Just wanted to know if i create a sphere using this method

ExtendedPrimitives.createEllipsoid(new SimpleVector(plsize,plsize,plsize), 128, 1f, 1f);

Will the  the sphere be at the origin/center or offset from it in some way?

Support / What do you use for audio/music
« on: June 09, 2015, 12:55:48 am »
I realize this might be slightly unrelated but i wanted to know in particular what libraries/frameworks do devs using jpct-ae rely on for playing back sounds , music, perhaps even managing playlists.

Pages: [1] 2