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

Pages: 1 2 3 [4] 5 6 7
46
Support / Re: Screen size/shape & view area?
« on: August 17, 2015, 09:38:38 pm »
If i can get that along with the field of views i can extrapolate where the edge of the screen is at any distance.

47
Support / Re: Screen size/shape & view area?
« on: August 17, 2015, 06:19:50 pm »
Is there a way to extract the coordinates of the image plane in world space? , I think if i have this it will all become very easy.

48
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.

49
Support / Re: Unusual reproducible bug with shaders glsl
« on: July 28, 2015, 07:17:31 pm »
I'm using a vec3 now  :D , i was only using a vec4 because the example i was working from did.

It's no longer an issue for me but i thought you'd want to know about it.

I really have no idea of the cause, just that when i use vec4 it crashes and when i use vec3 it's fine.

Not sure how the particle system works.

50
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
http://www.lighthouse3d.com/tutorials/glsl-tutorial/directional-lights-per-pixel/

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: http://www.jpct.net/jpct-ae/doc/com/threed/jpct/GLSLShader.html
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 https://www.youtube.com/watch?v=cn-iS4YnqnE 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(eye.xyz),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( colorout.xyz , 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.

51
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.

52
yup that was it, removed the titlebar and all my touches became perfectly accurate.

53
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 )
 {

        sphereOrigin.sub(rayOrigin);

        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));
        rayDirection.scalarMul(distance);
        SimpleVector r1 = new SimpleVector(rayDirection.calcAdd(rayOrigin));

        return new SimpleVector[]{r1};
   }


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

54
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?

55
Support / Re: What do you use for audio/music
« on: June 10, 2015, 12:46:28 pm »
Same  8)

56
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.

57
Support / ArcBall in JPCT?
« on: May 26, 2015, 03:59:25 pm »
anyone used ArcBall before with jpct? it looks like it could be very handy for rotating about things on touchscreen.

I'm attempting to implement it now with jpct and wanted to know if anyone else has already had success with this?

http://www.java-tips.org/other-api-tips-100035/112-jogl/1714-arcball-rotation-nehe-tutorial-jogl-port.html


http://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Tutorial_Arcball

58
Support / Annoying logcat spam, anyone else encountered this.
« on: December 16, 2014, 01:51:36 am »
Has anyone encountered logcat spam like this? I'm happens many times a second so im guessing it's something i'm doing wrong repeatedly with object3d 's but im not quite sure what.

It's not crashing the game and everything is still fast. But it's a nuisance, and might indicate im doing something wrong. I could probably filter it but i would prefer to see if i can simply stop it from happening.




59
Support / Re: Object3d switching/swapping in renderhook.
« on: November 24, 2014, 01:30:17 pm »
hmm ok, i'll iterating though at switching the references istead.

60
Support / Re: Object3d switching/swapping in renderhook.
« on: November 24, 2014, 01:01:04 pm »
I could try the visibility/switching trick.

If an objects visibility is set to completely transparent though will JPCT still go through all the calculations of trying to render the objects mesh?


Pages: 1 2 3 [4] 5 6 7