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

Pages: [1]
1
Support / Object/ Polygon draw order
« on: March 19, 2014, 06:23:47 pm »
Hi.
Is there anyway to specify a drawing order for objects?

Think of a plane used for the ground with a texture on it. I'm adding a 2D object on top of the ground - for example a puddle. Currently there is a lot of 'flickering' of the two objects during rendering. I'm guessing the GPU (?) can't decide what should be on top of what.

Any suggestions would be great!

Thanks.

2
Support / Update texture coordinates on object?
« on: February 17, 2014, 04:00:09 pm »
Is it possible to update the texture coordinates on an existing object at runtime?

In producing a real terrain I now have an issue with sheer volume of data. After reading a few posts, it appears the way to reduce creation time and memory overhead on Android is to pre-create models, serialize them and then load on the mobile device.
The issue I have with this approach is that I want to change the texture (and texture size) on the model dynamically once it is loaded. i.e.  I have a 200x200 quad plane as a serialize'd model which, once loaded, I can assign either one 200x200 texture to it, or 4 x 100 or 16 x 50 texture's etc.

Is this possible, or do I have to stick with creating the plane dynamically at runtime as well?!

Thanks.

3
Support / Terrain grid issue..
« on: February 09, 2014, 06:28:02 pm »
Hi,

Can anyone give me some clue as to what is happening with the vertex coordinates here?



I'm trying to create an irregular sized plane in order to create a terrain (this is currently shown in Wireframe mode).
Firstly, for a given bounding box I calculate the number of cells required in X and Y, along with the size of each 'cell'.

Then I loop through generating the vertex positions for each corner of each cell/ quad as so;

Code: [Select]
    Coordinate[] quads = new Coordinate[(xNum * yNum * 4)  ];
    Coordinate ll, ur;
    int cnt = 0;
   
for (int yd=0; yd < yNum; yd++) {
for (int xd=0; xd < xNum; xd++) {
ll = new Coordinate(bbox.getMinX() + (xSize*xd), bbox.getMinY() + (ySize*yd) );//lowerLeft
//ur = new Coordinate(bbox.getMinX() + (xSize*(xd+1)), bbox.getMinY() + (ySize*(yd+1)) );//upperRight
ur = new Coordinate(ll.x + xSize, ll.y+ySize);//upperRight

quads[cnt++] = new Coordinate(ll); //lowerLeft
quads[cnt++] = new Coordinate(ur);//upperRight
quads[cnt++] = new Coordinate(ll.x, ur.y); //upperLeft
quads[cnt++] = new Coordinate(ur.x, ll.y); //lowerRight

}
}

Lastly I create triangles for the coordinates and add to an Object3D;

Code: [Select]
Coordinate[] quadCS = quadGeom.getCoordinates();

    SimpleVector lowerLeft=new SimpleVector();
    SimpleVector upperRight=new SimpleVector();
    SimpleVector upperLeft=new SimpleVector();
    SimpleVector lowerRight=new SimpleVector();
plane = new Object3D(xNum * yNum * 2);

for (int c=0; c < quadCS.length-1; c+=4) {
    lowerLeft.set((float)quadCS[c].x, (float)quadCS[c].y, (float)quadCS[c].z);
    upperRight.set((float)quadCS[c+1].x, (float)quadCS[c+1].y, (float)quadCS[c+1].z);
    upperLeft.set((float)quadCS[c+2].x, (float)quadCS[c+2].y, (float)quadCS[c+2].z);
    lowerRight.set((float)quadCS[c+3].x, (float)quadCS[c+3].y, (float)quadCS[c+3].z);
    plane.addTriangle(
    upperLeft,0,0,
    lowerLeft,0,1,
    upperRight,1,0);
   plane.addTriangle(
    upperRight,1,0,
    lowerLeft,0,1,
    lowerRight,1,1);

}

I've tried this a couple different ways but don't seem to get the edge of the plane correct - Is this something happening internally with the vertex indexing, or am I not completing the 'square' correctly...?

Incidentally I would love to use the in-built getPlane(int, int) function, but this doesn't allow me to create for odd sizes, hence doing this manually.

Many thanks for any assistance...

4
Support / Re: multi-thread unsafe operations
« on: December 19, 2013, 12:22:24 pm »
In terms of the original question, is object creation and texture loading thread-safe?

I am creating objects and loading textures in a separate thread and then passing the objects to a Handler in the renderer which adds them to the world from a Stack in onDrawFrame(). Randomly these objects are not being displayed (incidentally all the objects are map tiles - 2 triangles with one texture).

Logcat reports that 9 textures are loaded, 9 objects are added to the world/ compiled, but potentially only 4 will actually be displayed.

Should texture's be loaded and/ or objects created in the render thread as well as adding?



5
Support / NullPointer in queue
« on: September 02, 2013, 08:53:58 pm »
Hi.
I'm getting a reasonably regular, but quite random crash as below. It appears to happen after deleting objects from the world;

Code: [Select]
09-02 19:13:22.063: I/jPCT-AE(13962): [ 1378145602065 ] - ERROR: Null object in queue...?
09-02 19:13:22.103: W/dalvikvm(13962): threadid=11: thread exiting with uncaught exception (group=0x41050450)
09-02 19:13:22.103: E/AndroidRuntime(13962): FATAL EXCEPTION: GLThread 551
09-02 19:13:22.103: E/AndroidRuntime(13962): java.lang.RuntimeException: [ 1378145602065 ] - ERROR: Null object in queue...?
09-02 19:13:22.103: E/AndroidRuntime(13962): at com.threed.jpct.Logger.log(Logger.java:193)
09-02 19:13:22.103: E/AndroidRuntime(13962): at com.threed.jpct.World.renderScene(World.java:1029)
09-02 19:13:22.103: E/AndroidRuntime(13962): at com.augtech.awilaSDK.graphics.JpctRenderer.onDrawFrame(JpctRenderer.java:162)
09-02 19:13:22.103: E/AndroidRuntime(13962): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1516)
09-02 19:13:22.103: E/AndroidRuntime(13962): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

Any pointers on what I should be looking for/ changing to stop this happening?
Many thanks in advance.

6
Support / Ground clamping through calcMinDistance with .obj's help
« on: February 08, 2013, 07:33:19 pm »
Hi all !
I'm trying to implement two things at the moment, and after three days its still driving me nuts! >:(

Firstly, and most importantly, I'm trying to automatically 'clamp' objects to the ground....yes that old chestnut! I've read many a post here, but I just can't get a catch all that works for .obj models and in-built primitives (like a cube, which I seem to have fixed now incidentally)

In the app I either create a primitive, such as a cube, or load an .obj model and then add it to the scene through the following method;

Code: [Select]
public void addObjectsToWorld(A_Object3D[] objects) {

if (objects==null || sceneOrientation==null) return;
SimpleVector frontAxis = sceneOrientation.front.normalize();
SimpleVector upAxis = sceneOrientation.up.normalize();

// Align our object axis to the ECEF axis
for (A_Object3D obj : objects) {
if (obj.requiresOrientation) {
obj.setOrientation(frontAxis, upAxis);
}
obj.applyStyleRotations();
obj.build();
}

// Add...
theWorld.addObjects(objects);

// Now clamp objects to the floor if flagged to do so...
SimpleVector trans = new SimpleVector();

for (A_Object3D obj : objects) {
if (!obj.clampToGround) continue;

float dist = plane.calcMinDistance( obj.getTransformedCenter(), upAxis );

// Move object above plane by 20m and try again
if (dist==Object3D.COLLISION_NONE) {
trans.set( upAxis );
trans.scalarMul( -20f );
obj.translate( trans );

dist = plane.calcMinDistance( obj.getTransformedCenter(), upAxis );

// Couldn't collide, move to original position
if (dist==Object3D.COLLISION_NONE) {
trans.set( upAxis );
trans.scalarMul( 20f );
obj.translate( trans );
}
}

// Do the clamping...
if (dist!=Object3D.COLLISION_NONE) {
float htAdjust = obj.isPlane ? 0f : -obj.getMesh().getBoundingBox()[3];

Log.i(LOG_TAG, "Obj: "+obj.getParentFeatureID()+" Dist: "+(dist+htAdjust));
trans.set( upAxis );
trans.scalarMul( dist-obj.heightOffset+htAdjust );

// (paulscode) Grab a handle to the Object3D's world transformation matrix:
Matrix m = new Matrix( obj.getWorldTransformation() );
// Turn that into a rotation matrix:
float[] dm = m.getDump();
for( int i = 12; i < 15; i++ ) dm[i] = 0;
dm[15] = 1;
m.setDump( dm );
// Apply this rotation matrix to the translation vector:
trans.matMul( m );

obj.translate( trans );
}
}

The plane object is a transparent plane sat 2m below the camera position.
Adding additional planes (map tiles) through the above method works; adding cubes works, but .obj models (and an arrow which I'll get to in the minute) does not. The links should hopefully illustrate;

Screen1: Primitive models sat on ground, but .obj model floating


Screen2: Model the same size and axis alignment, but sat below plane (the rotating arrow is sat below the overlay).



It should be noted that the models (not mine!) are exported from Sketch-up with the swap YZ axis option enabled. To then align the axis to jPCT I use the following;

Code: [Select]
if (shapeName.endsWith(".obj") || shapeName.endsWith(".3ds")) {
ret = getShapeFromAssets(shapeName);
/* jPCT axis are rotated 180 around X axis,
* contrary to most graphics systems, so we rotate and then
* replace the matrix so this rotation is ignored in later
* translations and rotations */
ret.obj.rotateZ(PI);// Why Z, not X ??? (Is Z so North is aligned)
ret.obj.rotateMesh();
ret.obj.setRotationMatrix( new Matrix() );
ret.obj.getMesh().setLocked(true);
}

I can seem to get a decent value from calcMinDistance, one model is 0.09m, whereas the other is 19.4m. ??

As a secondary issue, I'm trying display an arrow permanently in front of the camera, at a fixed distance, but also clamped to the ground. I suspect a very similar problem as, again, the arrow is loaded from an .obj, added to as a child to a dummyObject at the camera position and then translated to be in front of the camera. With the arrow being 8m in front of the camera, calcMinDistance is returning 6.9 metres from the plane!!??

Many, many thanks to the person who tells me what stupid thing I'm doing!

[attachment deleted by admin]

7
Support / obj.translate not moving object
« on: January 30, 2013, 07:40:59 pm »
Hi,
Can anyone tell me what I'm doing wrong here...
I'm trying to get an object to automatically place itself on the ground (a plane). I've read several posts on 'gravity' and collision detection, but nothing I do is actually moving the object.

I have an object 2m above a plane (manually created). The plane is set to
Code: [Select]
plane.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);and the 'floating' object is also set to Object3D.COLLISION_CHECK_OTHERS.
The objects are added to the world at runtime as follows
Code: [Select]
public void addObjectsToWorld(A_Object3D[] objects) {
if (objects==null) return;

for (A_Object3D obj : objects) {
if (obj.requiresOrientation==false || sceneOrientation==null) continue;

// Align and rotate to our scene
tmpDirVector.x = sceneOrientation.front.x;
tmpDirVector.y = sceneOrientation.front.y;
tmpDirVector.z = sceneOrientation.front.z;
tmpUpVector.x = sceneOrientation.up.x;
tmpUpVector.y = sceneOrientation.up.y;
tmpUpVector.z = sceneOrientation.up.z;

obj.setOrientation(tmpDirVector, tmpUpVector);

obj.applyStyleRotations();// X,Y,Z rotation done here so angles are correct for scene

}

// Add...
theWorld.addObjects(objects);
theWorld.buildAllObjects();

Immediately afterwards I've tried two methods to move the object as follows
Code: [Select]
for (A_Object3D obj : objects) {
if (!obj.clampToGround) continue;

// SimpleVector dir = obj.getYAxis();
// SimpleVector tmp = new SimpleVector(dir);
// obj.checkForCollisionEllipsoid(dir, ellipsoid, 1);
// if (!dir.equals(tmp)) {
// Log.i(LOG_TAG, "Obj collided "+dir.toString());
// obj.translate(dir);
// }
SimpleVector dir = obj.getYAxis();
float dist = theWorld.calcMinDistance(
obj.getOrigin(),
dir,
50f);
Log.i(LOG_TAG, "Dist="+dist);
if (dist!=Object3D.COLLISION_NONE) {
obj.translate(dir.x*dist, dir.y*dist, dir.z*dist);
}

}
The distance is logging as 3.7001638m, which isn't far out as the object is 1m square, although I think it should be more like 2.5m to the centre...
Anyway, the object does not move with the translate, even if I try 50f. I also tried to put the translate code into the onDrawFrame(), but still nothing :(

Could this be related to the objects all being cloned from an original?

8
Support / Removing textures during runtime
« on: January 28, 2013, 09:18:54 pm »
Hi Egon.
Thought I would post here as a general query.

Within my application I (can) re-use an object, such as a cube or arrow, many times... To save re-creation, memory and time I load each object type that is required into a HashMap with a name (like CUBE1) - if the same object is needed again, it is got from the Map and a new Object3D created from it via the Object3D( 'object_a' ) constructor (which I believe clones the original object).

This process also clones the textures assigned to object 'a' on object 'b' - which is fine except I want a different texture on object 'b' than 'a'. I set object 'b's texture to my newly required texture through obj.setTexture(), but it just <i>adds</i> a reference to the new texture, compared to replacing it. This would be fine, but I cannot remove/ change the reference to the original texture, therefore object 'b' now has two textures.

How can I re-use an object many times, whilst minimising replication, but keep changing the texture  - is there a way of doing obj.removeTexture(), obj.deleteTexture() or obj.replaceTexture() ?

Many thanks...

9
Bugs / Crash on Galaxy S3
« on: January 07, 2013, 09:34:28 pm »
Hi,

I have just released a new version of our app, and unfortunately there is a repeatable crash on a galaxy S3. The only 'big' difference I can think of between that and the galaxy S2 I have always tested on is Android 4.x vs 2.3.3 ... The only information I have (not owning an S3) is the reported stack trace as below;

Code: [Select]
java.lang.RuntimeException: [ 1357589905458 ] - ERROR: before: glError 1281
at com.threed.jpct.Logger.log(Logger.java:189)
at com.threed.jpct.GL20.checkError(GL20.java:142)
at com.threed.jpct.GL20.glGenBuffers(GL20.java:1324)
at com.threed.jpct.CompiledInstance.compileToVBO(CompiledInstance.java:1299)
at com.threed.jpct.CompiledInstance.render(CompiledInstance.java:533)
at com.threed.jpct.GLRenderer.drawVertexArray(GLRenderer.java:2246)
at com.threed.jpct.World.draw(World.java:1321)
at com.threed.jpct.World.draw(World.java:1083)
at com.augtech.awila.graphics.JpctRenderer.onDrawFrame(JpctRenderer.java:165)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1516)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

This happens after starting a new activity (such as a dialog) and then returning to the main activity that runs the rendering.

Could this be related to not re-creating the frame buffer if not required?

Code: [Select]
@Override
public void onSurfaceChanged(GL10 ignore, int width, int height) {
Globals.SCREEN_WIDTH = width;
Globals.SCREEN_HEIGHT = height;
if (frameBuffer==null) {
        frameBuffer = new FrameBuffer(Globals.SCREEN_WIDTH, Globals.SCREEN_HEIGHT);
        Log.i(LOG_TAG,"Frame buffer set - w: "+ Globals.SCREEN_WIDTH + ", h: "+Globals.SCREEN_HEIGHT );
}
}


Any ideas?!?
Many thanks in advance

10
Support / How to remove objects during runtime
« on: January 04, 2013, 09:15:35 pm »
Hi.

I'm trying to remove objects from the world during runtime but keep getting a concurrent thread modification error.
I've searched the forum but it seems no-one else is getting this issue?!

I have extended the Object3D class to add a 'allow remove' flag. Every 30seconds within the onDrawFrame method the code below is called, which checks for the flag and calls theWorld.removeObject(o); In the second iteration of the while loop I get the exception and no items are removed from the world - This causes memory issues after some time as more and more objects are added to the world, with none of the old ones being removed.

Code: [Select]
Enumeration<Object3D> e = theWorld.getObjects();
int i = 0;
try {
while (e.hasMoreElements()) {
A_Object3D o = (A_Object3D) e.nextElement();
if (o.isRemoved()) {
theWorld.removeObject(o);
o=null;
i++;
}
}
} catch (Exception err) {
Log.w(LOG_TAG, "Failed during object removal: "+err.getMessage() );
}


I'll admit I'm not too surprised to get this error, but don't know how to safely remove objects from the world that are no longer required.
Does anyone have any suggestions - i.e. can this only be done within the renderer onPause() event??

Many thanks.

11
Support / 3ds model faces/ textures not rendering
« on: October 19, 2012, 01:11:23 pm »
Hi.
I have started using jPCT-AE for proper 3D models now (!) but have an issue importing a 3ds model created in Sketch-Up (Please note this is not my model - Respect to PaulWall on the Warehouse for them).

A few of the textures don't appear to be rendering correctly - please see screenshots for comparison.

I have tried all several config switches and Object3D options such as disabling culling, disabling/ changing lighting and increasing the number of polygons to 2048, but nothing has enabled the texture to be displayed correctly. The vast majority of things in the model are fine, but there are a few anomalies such as the images.

Can anyone suggest what is wrong, and if there is something I should be enabling/ disabling to improve this?

Quote
Edit: This is not just related to 3ds - I've switched to using .obj as I needed to amend some of the texture names to avoid duplicates, but exactly the same things apply

This is the set-up for the renderer;
Code: [Select]
public JpctRenderer(RGBColor b) {
Config.farPlane=1500;
Config.nearPlane = 0f;
Config.oldStyle3DSLoader = true;
Config.maxPolysVisible=2048;

theWorld = new World();
cameraController = new CameraOrbitController(theWorld.getCamera());
cameraController.cameraAngle = 0;
theWorld.setAmbientLight(127, 127, 127);
}

Texture loading...

Code: [Select]
// Only rescale if we have to
size = Transform.upperPowerOfTwo(size);
Texture t = new Texture(BitmapHelper.rescale(bitmap, size, size));
t.compress();
textManager.addTexture(textureName, t);

And the loading of the model...

Code: [Select]
Object3D obj = Object3D.mergeAll(Loader.load3DS(shapestream, 1));
obj.rotateY((float)Math.toRadians(90));
obj.rotateZ((float)Math.toRadians(90));
obj.translate(0,0,-6f);
world.addObject(obj);

float[] bb = obj.getMesh().getBoundingBox();
float height = (bb[3] - bb[2]);
new Light(world).setPosition(new SimpleVector(0, -height/2, height));

world.buildAllObjects();

Logcat...
Code: [Select]
I/jPCT-AE(10791): Loading Texture...
I/jPCT-AE(10791): Texture loaded...65536 bytes/128*128 pixels!
I/jPCT-AE(10791): Loading Texture...
I/jPCT-AE(10791): Texture loaded...65536 bytes/128*128 pixels!
I/jPCT-AE(10791): Loading Texture...
I/jPCT-AE(10791): Texture loaded...65536 bytes/128*128 pixels!
I/jPCT-AE(10791): Loading Texture...
I/jPCT-AE(10791): Texture loaded...65536 bytes/128*128 pixels!
I/jPCT-AE(10791): Loading Texture...
I/jPCT-AE(10791): Texture loaded...65536 bytes/128*128 pixels!
I/jPCT-AE(10791): Loading Texture...
I/jPCT-AE(10791): Texture loaded...65536 bytes/128*128 pixels!
I/jPCT-AE(10791): Loading Texture...
I/jPCT-AE(10791): Texture loaded...65536 bytes/128*128 pixels!
I/jPCT-AE(10791): Loading Texture...
I/jPCT-AE(10791): Texture loaded...65536 bytes/128*128 pixels!
I/jPCT-AE(10791): Loading Texture...
I/jPCT-AE(10791): Texture loaded...65536 bytes/128*128 pixels!
I/jPCT-AE(10791): Loading Texture...
I/jPCT-AE(10791): Texture loaded...65536 bytes/128*128 pixels!
I/jPCT-AE(10791): Loading Texture...
I/jPCT-AE(10791): Texture loaded...65536 bytes/128*128 pixels!
I/jPCT-AE(10791): Loading Texture...
I/jPCT-AE(10791): Texture loaded...65536 bytes/128*128 pixels!
I/jPCT-AE(10791): Loading Texture...
I/jPCT-AE(10791): Texture loaded...65536 bytes/128*128 pixels!
I/jPCT-AE(10791): Loading Texture...
I/jPCT-AE(10791): Texture loaded...65536 bytes/128*128 pixels!
I/jPCT-AE(10791): Loading Texture...
I/jPCT-AE(10791): Texture loaded...65536 bytes/128*128 pixels!
I/jPCT-AE(10791): Loading Texture...
I/jPCT-AE(10791): Texture loaded...65536 bytes/128*128 pixels!
I/jPCT-AE(10791): Loading Texture...
I/jPCT-AE(10791): Texture loaded...65536 bytes/128*128 pixels!
I/jPCT-AE(10791): Loading Texture...
I/jPCT-AE(10791): Texture loaded...65536 bytes/128*128 pixels!
I/jPCT-AE(10791): Loading Texture...
I/jPCT-AE(10791): Texture loaded...65536 bytes/128*128 pixels!
I/jPCT-AE(10791): Loading Texture...
I/jPCT-AE(10791): Texture loaded...65536 bytes/128*128 pixels!
I/jPCT-AE(10791): Loading file from InputStream
I/jPCT-AE(10791): Expanding buffers...16384 bytes
I/jPCT-AE(10791): Expanding buffers...24576 bytes
I/jPCT-AE(10791): Expanding buffers...32768 bytes
I/jPCT-AE(10791): Expanding buffers...40960 bytes
I/jPCT-AE(10791): Expanding buffers...49152 bytes
I/jPCT-AE(10791): Expanding buffers...57344 bytes
I/jPCT-AE(10791): Expanding buffers...65536 bytes
I/jPCT-AE(10791): Expanding buffers...73728 bytes
I/jPCT-AE(10791): Expanding buffers...81920 bytes
I/jPCT-AE(10791): Expanding buffers...163840 bytes
I/jPCT-AE(10791): Expanding buffers...245760 bytes
I/jPCT-AE(10791): Expanding buffers...327680 bytes
I/jPCT-AE(10791): Expanding buffers...409600 bytes
I/jPCT-AE(10791): Expanding buffers...491520 bytes
I/jPCT-AE(10791): Expanding buffers...573440 bytes
I/jPCT-AE(10791): Expanding buffers...655360 bytes
I/jPCT-AE(10791): Expanding buffers...737280 bytes
I/jPCT-AE(10791): Expanding buffers...819200 bytes
I/jPCT-AE(10791): Expanding buffers...901120 bytes
I/jPCT-AE(10791): File from InputStream loaded...893524 bytes
I/jPCT-AE(10791): Processing new material Color_00!
I/jPCT-AE(10791): Processing new material Color_01!
I/jPCT-AE(10791): Processing new material Cladding!
I/jPCT-AE(10791): Processing new material Material!
I/jPCT-AE(10791): Processing new material Roofing_!
I/jPCT-AE(10791): Processing new material Color_02!
I/jPCT-AE(10791): Processing new material Color_03!
I/jPCT-AE(10791): Processing new material _Roofing!
I/jPCT-AE(10791): Processing new material Brick_St!
I/jPCT-AE(10791): Processing new material _Fencing!
I/jPCT-AE(10791): Processing new material _Translu!
I/jPCT-AE(10791): Processing new material Transluc!
I/jPCT-AE(10791): Processing new material Sketchy_!
I/jPCT-AE(10791): Processing new material Color_F1!
I/jPCT-AE(10791): Processing new material Fencing_!
I/jPCT-AE(10791): Processing new material Claddi01!
I/jPCT-AE(10791): Processing new material _Brick_T!
I/jPCT-AE(10791): Processing new material Wood_Flo!
I/jPCT-AE(10791): Processing new material _Wood_Ch!
I/jPCT-AE(10791): Processing new material Wood_Boa!
I/jPCT-AE(10791): Processing new material _Claddin!
I/jPCT-AE(10791): Processing new material Materi01!
I/jPCT-AE(10791): Processing new material _Wood__F!
I/jPCT-AE(10791): Processing new material Beige!
I/jPCT-AE(10791): Processing new material _Wood_OS!
I/jPCT-AE(10791): Processing new material Water_De!
I/jPCT-AE(10791): Processing new material _Tile_Ch!
I/jPCT-AE(10791): Processing new material Color_04!
I/jPCT-AE(10791): Processing new material _Ivory_1!
I/jPCT-AE(10791): Processing new material _LightGr!
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob_1
I/jPCT-AE(10791): Object 'DoorKnob_1_jPCT0' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob01
I/jPCT-AE(10791): Object 'DoorKnob01_jPCT1' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob02
I/jPCT-AE(10791): Object 'DoorKnob02_jPCT2' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob03
I/jPCT-AE(10791): Object 'DoorKnob03_jPCT3' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob04
I/jPCT-AE(10791): Object 'DoorKnob04_jPCT4' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob05
I/jPCT-AE(10791): Object 'DoorKnob05_jPCT5' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob06
I/jPCT-AE(10791): Object 'DoorKnob06_jPCT6' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob07
I/jPCT-AE(10791): Object 'DoorKnob07_jPCT7' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob08
I/jPCT-AE(10791): Object 'DoorKnob08_jPCT8' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob09
I/jPCT-AE(10791): Object 'DoorKnob09_jPCT9' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob10
I/jPCT-AE(10791): Object 'DoorKnob10_jPCT10' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob11
I/jPCT-AE(10791): Object 'DoorKnob11_jPCT11' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob12
I/jPCT-AE(10791): Object 'DoorKnob12_jPCT12' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob13
I/jPCT-AE(10791): Object 'DoorKnob13_jPCT13' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob14
I/jPCT-AE(10791): Object 'DoorKnob14_jPCT14' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob15
I/jPCT-AE(10791): Object 'DoorKnob15_jPCT15' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob16
I/jPCT-AE(10791): Object 'DoorKnob16_jPCT16' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob17
I/jPCT-AE(10791): Object 'DoorKnob17_jPCT17' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob18
I/jPCT-AE(10791): Object 'DoorKnob18_jPCT18' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob19
I/jPCT-AE(10791): Object 'DoorKnob19_jPCT19' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob20
I/jPCT-AE(10791): Object 'DoorKnob20_jPCT20' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob21
I/jPCT-AE(10791): Object 'DoorKnob21_jPCT21' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob22
I/jPCT-AE(10791): Object 'DoorKnob22_jPCT22' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob23
I/jPCT-AE(10791): Object 'DoorKnob23_jPCT23' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob24
I/jPCT-AE(10791): Object 'DoorKnob24_jPCT24' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob25
I/jPCT-AE(10791): Object 'DoorKnob25_jPCT25' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob26
I/jPCT-AE(10791): Object 'DoorKnob26_jPCT26' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob27
I/jPCT-AE(10791): Object 'DoorKnob27_jPCT27' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob28
I/jPCT-AE(10791): Object 'DoorKnob28_jPCT28' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob29
I/jPCT-AE(10791): Object 'DoorKnob29_jPCT29' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob30
I/jPCT-AE(10791): Object 'DoorKnob30_jPCT30' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob31
I/jPCT-AE(10791): Object 'DoorKnob31_jPCT31' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: DoorKnob32
I/jPCT-AE(10791): Object 'DoorKnob32_jPCT32' created using 47 polygons and 28 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: Mesh01
I/jPCT-AE(10791): Object 'Mesh01_jPCT33' created using 16675 polygons and 8120 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: Mesh02
I/jPCT-AE(10791): Object 'Mesh02_jPCT34' created using 484 polygons and 244 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: Mesh03
I/jPCT-AE(10791): Object 'Mesh03_jPCT35' created using 220 polygons and 112 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: Mesh04
I/jPCT-AE(10791): Object 'Mesh04_jPCT36' created using 256 polygons and 130 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: Mesh05
I/jPCT-AE(10791): Object 'Mesh05_jPCT37' created using 256 polygons and 130 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: Mesh06
I/jPCT-AE(10791): Object 'Mesh06_jPCT38' created using 252 polygons and 128 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: Mesh07
I/jPCT-AE(10791): Object 'Mesh07_jPCT39' created using 1344 polygons and 660 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: Mesh08
I/jPCT-AE(10791): Object 'Mesh08_jPCT40' created using 228 polygons and 116 vertices.
I/jPCT-AE(10791): Processing object from 3DS-file: Model
I/jPCT-AE(10791): Name in hierarchy found: Model
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob_1
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob01
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob02
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob03
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob04
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob05
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob06
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob07
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob08
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob09
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob10
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob11
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob12
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob13
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob14
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob15
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob16
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob17
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob18
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob19
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob20
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob21
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob22
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob23
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob24
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob25
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob26
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob27
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob28
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob29
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob30
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob31
I/jPCT-AE(10791): Name in hierarchy found: DoorKnob32
I/jPCT-AE(10791): Name in hierarchy found: Mesh01
I/jPCT-AE(10791): Name in hierarchy found: Mesh02
I/jPCT-AE(10791): Name in hierarchy found: Mesh03
I/jPCT-AE(10791): Name in hierarchy found: Mesh04
I/jPCT-AE(10791): Name in hierarchy found: Mesh05
I/jPCT-AE(10791): Name in hierarchy found: Mesh06
I/jPCT-AE(10791): Name in hierarchy found: Mesh07
I/jPCT-AE(10791): Name in hierarchy found: Mesh08
I/jPCT-AE(10791): Adding Lightsource: 0
I/jPCT-AE(10791): Normal vectors calculated in 565ms!
I/jPCT-AE(10791): MSAA enabled with 2 samples!
I/jPCT-AE(10791): Initializing GL20 render pipeline...
I/jPCT-AE(10791): Accessing shaders via JAR!
I/jPCT-AE(10791): Loading default shaders !
I/jPCT-AE(10791): 0 shaders in replacement map!
I/jPCT-AE(10791): Default fragment shader is: /defaultFragmentShader.src
I/jPCT-AE(10791): Loading file from InputStream
I/jPCT-AE(10791): Text file from InputStream loaded...2008 bytes
I/jPCT-AE(10791): Default vertex shader is: /defaultVertexShader.src
I/jPCT-AE(10791): Loading file from InputStream
I/jPCT-AE(10791): Text file from InputStream loaded...4496 bytes
I/jPCT-AE(10791): Compiling shader program!
I/jPCT-AE(10791): Handles of 3: 0/32
I/jPCT-AE(10791): Loading default shaders (Tex0)!
I/jPCT-AE(10791): 0 shaders in replacement map!
I/jPCT-AE(10791): Default fragment shader is: /defaultFragmentShader.src
I/jPCT-AE(10791): Loading file from InputStream
I/jPCT-AE(10791): Text file from InputStream loaded...201 bytes
I/jPCT-AE(10791): Default vertex shader is: /defaultVertexShader.src
I/jPCT-AE(10791): Loading file from InputStream
I/jPCT-AE(10791): Text file from InputStream loaded...4020 bytes
I/jPCT-AE(10791): Compiling shader program!
I/jPCT-AE(10791): Handles of 6: 0/29
I/jPCT-AE(10791): Loading default shaders (Tex1)!
I/jPCT-AE(10791): 0 shaders in replacement map!
I/jPCT-AE(10791): Default fragment shader is: /defaultFragmentShader.src
I/jPCT-AE(10791): Loading file from InputStream
I/jPCT-AE(10791): Text file from InputStream loaded...871 bytes
I/jPCT-AE(10791): Default vertex shader is: /defaultVertexShader.src
I/jPCT-AE(10791): Loading file from InputStream
I/jPCT-AE(10791): Text file from InputStream loaded...4390 bytes
I/jPCT-AE(10791): Compiling shader program!
I/jPCT-AE(10791): Handles of 9: 0/32
I/jPCT-AE(10791): Loading default shaders (Tex0Light0)!
I/jPCT-AE(10791): 0 shaders in replacement map!
I/jPCT-AE(10791): Default fragment shader is: /defaultFragmentShader.src
I/jPCT-AE(10791): Loading file from InputStream
I/jPCT-AE(10791): Text file from InputStream loaded...201 bytes
I/jPCT-AE(10791): Default vertex shader is: /defaultVertexShader.src
I/jPCT-AE(10791): Loading file from InputStream
I/jPCT-AE(10791): Text file from InputStream loaded...1293 bytes
I/jPCT-AE(10791): Compiling shader program!
I/jPCT-AE(10791): Handles of 12: 0/7
I/jPCT-AE(10791): Loading default shaders (Fog)!
I/jPCT-AE(10791): 0 shaders in replacement map!
I/jPCT-AE(10791): Default fragment shader is: /defaultFragmentShader.src
I/jPCT-AE(10791): Loading file from InputStream
I/jPCT-AE(10791): Text file from InputStream loaded...328 bytes
I/jPCT-AE(10791): Default vertex shader is: /defaultVertexShader.src
I/jPCT-AE(10791): Loading file from InputStream
I/jPCT-AE(10791): Text file from InputStream loaded...4267 bytes
I/jPCT-AE(10791): Compiling shader program!
I/jPCT-AE(10791): Handles of 15: 0/32
I/jPCT-AE(10791): Loading default shaders (FogLight0)!
I/jPCT-AE(10791): 0 shaders in replacement map!
I/jPCT-AE(10791): Default fragment shader is: /defaultFragmentShader.src
I/jPCT-AE(10791): Loading file from InputStream
I/jPCT-AE(10791): Text file from InputStream loaded...328 bytes
I/jPCT-AE(10791): Default vertex shader is: /defaultVertexShader.src
I/jPCT-AE(10791): Loading file from InputStream
I/jPCT-AE(10791): Text file from InputStream loaded...1608 bytes
I/jPCT-AE(10791): Compiling shader program!
I/jPCT-AE(10791): Handles of 18: 0/10
I/jPCT-AE(10791): Loading default shaders (Tex0Amb)!
I/jPCT-AE(10791): 0 shaders in replacement map!
I/jPCT-AE(10791): Default fragment shader is: /defaultFragmentShader.src
I/jPCT-AE(10791): Loading file from InputStream
I/jPCT-AE(10791): Text file from InputStream loaded...199 bytes
I/jPCT-AE(10791): Default vertex shader is: /defaultVertexShader.src
I/jPCT-AE(10791): Loading file from InputStream
I/jPCT-AE(10791): Text file from InputStream loaded...757 bytes
I/jPCT-AE(10791): Compiling shader program!
I/jPCT-AE(10791): Handles of 21: 0/3
I/jPCT-AE(10791): Loading default shaders (Depth)!
I/jPCT-AE(10791): 0 shaders in replacement map!
I/jPCT-AE(10791): Default fragment shader is: /defaultFragmentShader.src
I/jPCT-AE(10791): Loading file from InputStream
I/jPCT-AE(10791): Text file from InputStream loaded...745 bytes
I/jPCT-AE(10791): Default vertex shader is: /defaultVertexShader.src
I/jPCT-AE(10791): Loading file from InputStream
I/jPCT-AE(10791): Text file from InputStream loaded...248 bytes
I/jPCT-AE(10791): Compiling shader program!
I/jPCT-AE(10791): Handles of 24: 0/0
I/jPCT-AE(10791): GL20 render pipeline initialized!
I/jPCT-AE(10791): OpenGL vendor:     ARM
I/jPCT-AE(10791): OpenGL renderer:   Mali-400 MP
I/jPCT-AE(10791): OpenGL version:    OpenGL ES 2.0
I/jPCT-AE(10791): OpenGL renderer initialized (using 2 texture stages)
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 228/144 vertices in 17ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 72/40 vertices in 3ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 1059/363 vertices in 11ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 102/50 vertices in 2ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 42/18 vertices in 0ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 2304/936 vertices in 19ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 201/115 vertices in 2ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 12/8 vertices in 1ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 6/4 vertices in 0ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 99/55 vertices in 2ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 603/211 vertices in 8ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 243/125 vertices in 3ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 336/164 vertices in 4ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 156/58 vertices in 2ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 30/16 vertices in 12ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 186/62 vertices in 3ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 282/196 vertices in 4ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 540/336 vertices in 6ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 12/8 vertices in 0ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 84/40 vertices in 1ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 4653/2541 vertices in 44ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 23997/11328 vertices in 273ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 10689/4940 vertices in 115ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 270/184 vertices in 3ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 768/193 vertices in 5ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 13437/5585 vertices in 130ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 72/48 vertices in 1ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 864/348 vertices in 8ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 90/44 vertices in 1ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 2286/1128 vertices in 19ms!
I/jPCT-AE(10791): Subobject of object 42/object44 compiled to indexed fixed point data using 75/45 vertices in 1ms!
I/jPCT-AE(10791): Object 42/object44 compiled to 31 subobjects in 916ms!

Many thanks for any suggestions...

[attachment deleted by admin]

12
Support / Draw ground level grid
« on: October 13, 2012, 01:05:04 pm »
Hi.
I am trying to draw a basic grid of 100m size tiles at floor/ ground level within my scene (think '80s Tron!)
I thought the new Polyline() class would be idea for this but it doesn't get rendered at all. :) Would Polyline be the right choice for this, or should I be creating something with Plane() ? Incidentally I want to be able to switch it on and off, but I can't see a method for removing/ changing the visibility of poylines on World().
Code: [Select]
public static Polyline testPolyLine(SimpleVector origin) {
SimpleVector o = origin;

SimpleVector[] points = new SimpleVector[4];
points[0] = new SimpleVector(o.x,o.y,o.z-100);
points[1] = new SimpleVector(o.x,o.y,o.z+100);
points[2] = new SimpleVector(o.x,o.y-100,o.z);
points[3] = new SimpleVector(o.x,o.y+100,o.z);

return new Polyline(points, new RGBColor(130, 130, 130));

}
And at start-up (when a position is known)
Code: [Select]
getRenderer().getTheWorld().addPolyline( Utilities.testPolyLine( gridOrigin ) );

As a note; the java doc doesn't include the Polyline() class...

Many thanks in advance.

13
Support / object list not being consistent during rendering
« on: December 11, 2011, 01:01:44 pm »
Hi,
I wanted to check if there is a specific order to adding and building objects within the world(!) on an ongoing basis.

My application is dynamically creating and building objects based on a download, and then adding them into the world, but very quickly this results in the message
Quote
There's a problem with the object list not being consistent during rendering. This is often caused by concurrent modification of jPCT objects on a thread different from the rendering thread!

I am trying to store the un-built objects built within an arraylist as they are downloaded and created, and then based on a timer within the onDrawFrame() method rattle through the list adding them into the world to try and ensure that the render thread is in control, but this doesn't help.

What seems to happen is that (for example) 1300 objects are created, then the addObject timer kicks in and adds them to the world - this is fine. The next time the addObject timer kicks in, it adds another 20 objects to the world, at which point the above error happens and kills the application. (Previously the objects were added as they were downloaded)

I have tried calling theWorld.buildAllObjects(); and theWorld.compileAllObjects(frameBuffer); after the objects are added, which helps stability for the first set of objects, but the error still happens the second time around.

Code: [Select]
public void onDrawFrame(GL10 arg0) {
long thisFrameTime = System.currentTimeMillis();

// Render the scene
theWorld.renderScene(frameBuffer);
theWorld.draw(frameBuffer);
frameBuffer.display();

if (thisFrameTime - addTime >= 5000) addObjectsToWorld();
}

private void addObjectsToWorld() {
//if (runed) return;
int i=0;
for (Dataset ds : theApp.getTheRegistry().getDataContainer()) {
for (Feature f : ds.getFeatureCollection()) {
if (f.isBuilt() && f.isVisible() && !f.isInWorld()) {
for (A_Object3D o : f.get3DObjects()) {
f.setInWorld(true);
theWorld.addObject(o);
}
i++;
}
}
}

if (i>0) {
theWorld.buildAllObjects();
try {
theWorld.compileAllObjects(frameBuffer);
} catch (Exception e) {
e.printStackTrace();
}
}
Log.i("Render","Added "+i+" objects to world");
addTime = System.currentTimeMillis();
}

Any help would be much appreciated

14
Support / Set LookAt Matrix
« on: November 27, 2011, 01:49:32 pm »
Hi,
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.eyeX,
    newCamera.eyeY,
    newCamera.eyeZ,
    newCamera.frontX + newCamera.eyeX,
    newCamera.frontY + newCamera.eyeY,
    newCamera.frontZ + newCamera.eyeZ,
    newCamera.upX,
    newCamera.upY,
    newCamera.upZ);
   }

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(
    newCamera.upX,
    newCamera.upY,
    newCamera.upZ);

    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]