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

Pages: 1 ... 3 4 [5]
Support / Re: [Tips] Android, augmented reality 3D with JPCT + Camera.
« on: December 01, 2011, 03:10:16 pm »
Awesome, thanks Egon. Let me know and I'll test.

Support / Re: [Tips] Android, augmented reality 3D with JPCT + Camera.
« on: December 01, 2011, 01:12:18 pm »
A quick query, or a bug...!

I am doing some of the same as within this thread, but have opted for using the AAConfigChooser as it makes my scene look a lot nicer, but I've lost the transparency so therefore cannot see the camera preview (except on areas of textures!)

In the SurfaceView;

Code: [Select]
    setEGLConfigChooser(new AAConfigChooser(this));

And then within the renderer onDrawFrame();

Code: [Select]
frameBuffer.clear(new RGBColor(0,0,0,0));

Does AAConfigChooser() support transparent background, and if so, how?

Incidentally, I have tried PixelFormat.TRANSLUCENT within the SurfaceView to no effect.


Support / Re: Set LookAt Matrix
« on: December 01, 2011, 12:58:39 pm »
Many thanks for this - it has solved the issue!!

I previously had the eye position added to the direction vertex as the LookAt() function in OpenGL was taking the vector as an absolute point to look at. The effect was as I moved forward, the camera always pointed at the same place, therefore 'twisting' the rotation (as if continually turning one's head).

It appears jPCT is not doing the same, therefore you can keep looking in a direction, but walk parallel to it just by updating the camera position.

I have an additional question, but will start a seperate thread as its unrelated.

Support / Set LookAt Matrix
« on: November 27, 2011, 01:49:32 pm »
Last week I implemented jPCT-AE within my AR application instead of using my own OpenGL renderer; and first-off let me say that it is excellent, providing many more features than I could possibly code myself!

Like many others, I have some issues with rotations, but I did previously have this working (along with GPS location updates) very well. Due to the the various coordinate systems in play, I am generating vectors to describe the direction the camera should be facing in ECEF coordinates. These vectors were fed to the renderer as below;

Code: [Select]
private float[] mLookMatrix = new float[16];

    public void setCameraPosition(CamPosition newCamera) {
    Matrix.setLookAtM(mLookMatrix, 0,
    newCamera.frontX + newCamera.eyeX,
    newCamera.frontY + newCamera.eyeY,
    newCamera.frontZ + newCamera.eyeZ,

with the following function being called on each DrawFrame();

Code: [Select]
private void setViewAndProjection() {
        float[] modelMatrix = new float[16]; // model matrix (identity)
        Matrix.setIdentityM(modelMatrix, 0);
        Matrix.translateM(modelMatrix, 0, 0, 0, 0);

        // calculating the current model-view-projection matrix
        Matrix.frustumM(mProjMatrix, 0,
        -fSize, fSize,
        -fSize / ratio, fSize / ratio,
        zNear, viewRange);

        // multiply matrices
        Matrix.multiplyMM(mWorldMatrix, 0, mProjMatrix, 0, mLookMatrix, 0);
        Matrix.multiplyMM(modelViewProjectionMatrix, 0, mWorldMatrix, 0, modelMatrix, 0);
        GLES20.glUniformMatrix4fv(muMVPMatrixHandle, 1, false, modelViewProjectionMatrix, 0);

Obviously a lot of this is no longer needed, but my issue is finding a suitable replacement for the Matrix.setLookAt() function within jPCT-AE.

The issue I have is that using
Code: [Select]
    public void setCameraPosition(CamPosition newCamera) {
    SimpleVector dir = new SimpleVector(
    newCamera.frontX + newCamera.eyeX,
    newCamera.frontY + newCamera.eyeY,
    newCamera.frontZ + newCamera.eyeZ
    SimpleVector up = new SimpleVector(

    worldCamera.setOrientation(dir, up);
    worldCamera.setPosition(newCamera.eyeX, newCamera.eyeY, newCamera.eyeZ);

...results in some very strange results! Initially 'the world' is viewed as before, but after a randomly short period of time, during movement of the device the axis of rotation get screwed up (x,y or z are inverted or switched) or just point in  another direction to the one I am facing.

I have tried getting and setting the camera matrix directly, but with no benefit. Additionally I have searched the forum, but the various code snippets didn't help either, due to angles not being used.

Could anyone suggest either what is wrong, or how I can set the lookAt vectors in jPCT-AE as is done in OpenGL ??

Many thanks in advance.

Pages: 1 ... 3 4 [5]