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

Pages: 1 [2] 3 4 ... 6
Support / Coordinate conversion
« on: October 08, 2015, 11:27:58 am »


I have an issue with the jPCT-AE coordinate system.

In my application the Object3Ds are positioned from an application using the Opengl coordinate system.

How can i convert the opengl coordinate system to jPCT-AE coordinate system?

For example , when the third party application calls the Object3D.translate(float x, float y, float z) method then what steps i have to follow

to do the conversion?

Thanks in advance

Support / Re: Integrating JPCT-AE with Vuforia - Rotation of modelViewMatrix
« on: September 25, 2015, 02:57:14 pm »

Support / Re: Integrating JPCT-AE with Vuforia - Rotation of modelViewMatrix
« on: September 25, 2015, 02:41:37 pm »


you mean the ?

I have followed the directions of this tutorial, it is very helpfull.

Actually I use the java version of detecting a marker instead of C++.

I agree with the "the model view matrix is nothing that you can just set into an Object3D. ... it's the end of transformation."

Well, I check my code deeply.

Thanks for your time.

Support / Re: Integrating JPCT-AE with Vuforia - Rotation of modelViewMatrix
« on: September 24, 2015, 08:55:20 am »

Ok, thanks, I understand you.

Also, I have to check my source code about the incorrect appearance of 3d objects.

Also i have another question.The rotated modelview matrix passed from Qualco engine to JPCT-AE is actually the modelview matrix of the marker.

When I insert a 3d object, this has a different modelview matrix?

When i rotate a 3d object calling the Object3D.rotateX() method (or rotateY(),rotateZ()) I noticed that when i move the marker or the camera, the rotated object3D is not actually in the same position, it moves slightly.

The same issue i have when i scale the object3d.

How can i solve this issue? I have to use a difference approach to rotate or scale the object3d?

Thanks in advance

Support / Integrating JPCT-AE with Vuforia - Rotation of modelViewMatrix
« on: September 23, 2015, 11:37:11 pm »


In JPCT-AE  - Vuforia integration procces, the modelview matrix created by Qualcomm's Vuforia engine is rotated 180 degrees around X axis before sending it to jPCT-AE, due to jPCT's coordinate system.

My question is if rotating the modelview matrix will have the result of displaying the 3D Objects upside down.

Also, is it possible JPCT-AE to have the same coordinate system as OpenGL? any special version of JPCT-AE perhaps? or configuration?

Thanks in Advance

Support / Re: VertexAttributes.update () issue
« on: September 12, 2015, 10:37:03 pm »
I finally found a way to solve the problem.

When I create a Object3D  i dont add it directly to the world calling the world.add(Object3D).

I call an AsyncTask having the following code

         protected String doInBackground(Augmented3dModel... arg0) {
AR3dModel ar3dModel = arg0[0];
                    try {
                                 ar3dModel .shouldBeAdded = true;
                             } catch (InterruptedException e) {
                     return null;

                            In the OnDrawFrame i added the following code:

                                 if(ar3dModel .shouldBeAdded == true){
                                   world.add( ar3dModel .getObject3d());//adds the created Object3D
                                   ar3dModel .shouldBeAdded = false;

AR3dModel  is a wrapper class of the Object3D.

Perhaps the delay of 200ms helps to fix the problem.

Best Regards

Support / Re: VertexAttributes.update () issue
« on: September 02, 2015, 11:06:49 pm »

perhaps some direct OpenGL calls from Vuforia cause the exception.
Part of Vuforia source code in my application calls directly some OpenGL methods

I will search deeply in my source code to address the issue.

I will inform you for the results.

Thanks for your time

Support / Re: VertexAttributes.update () issue
« on: September 02, 2015, 09:59:22 pm »


one texture has side 2048x2048,two have 1024x512 and the 4 rest  have smaller.

But the same issue happens with smaller size textures.

I check carefully the code and i will try to reproduce it.

The application is built with vuforia library.

I noticed that the exception happens when the application has find the trucker (marker) at the same time the object3d model is added to the World.

If the application has not find the trucker (marker) at the time the model is added to World, but finds it after a few seconds, then there is no problem.

When an Augmented reality application finds a trucker (marker) then draws the object3d model.

Thanks for your time

I will post the complete log when i reproduce the exception again.

Support / Re: VertexAttributes.update () issue
« on: September 02, 2015, 06:42:29 pm »

I will try to reproduce the issue again. I think happens only if the Object3dD model has texture.

A log info when the exception happens is:

D/ARRenderer(4310): world.draw() start

08-31 20:23:38.128: W/Adreno-ES20(4310): <core_glUseProgram:1525>: GL_INVALID_VALUE

08-31 20:23:38.128: I/jPCT-AE(4310): Creating buffers...

08-31 20:23:38.128: E/jPCT-AE(4310): [ 1441041818133 ] - ERROR: before: glError 1281

08-31 20:23:38.128: D/ARRenderer(4310): ################## world.draw exception ##################

08-31 20:23:38.128: D/ARRenderer(4310): world.draw() end

08-31 20:23:38.138: D/ARRenderer(4310): onSurfaceChanged start

08-31 20:23:38.138: D/ARRenderer(4310): onSurfaceChanged fb.dispose 1

The word.draw(fb) is in try/catch and when the exception happens the " ################## world.draw exception ##################" is printed.

I will  check again the source code.

Thanks in Advance

Support / Re: VertexAttributes.update () issue
« on: September 02, 2015, 04:07:04 pm »


thanks for the answer.

When you say rendering thread what you mean?
Do you have an example code?

It is safe to manipulate jPCT related instances (like instances of World, Object3D...)
inside the onDrawFrame() method?

In my application when I create  new Object3D model I added it in a queue (Vector) and in onDrawFrame() I read the queue .
If there is a pending Object3D model (not added in the World) then I call the method world.add(Object3D ).

The reading of queue is done before the world.draw(fb).

It is safe this way?

Thanks in advance

Support / Re: VertexAttributes.update () issue
« on: September 01, 2015, 01:55:56 pm »

Thanks for your answer.

Is it possible to create and add an object3d in the world (world.add(Object3D)) while the the renderer is active ?.

In many cases I receive exception while i try to add an Object3d to the world.

Thanks in advance

Support / VertexAttributes.update () issue
« on: September 01, 2015, 09:34:35 am »

I want to render an OBJ object3d.
Part of the initialization code is:

Code: [Select]
GroupOfModels3D = Loader.loadOBJ(objStream, mtlStream, scale);
object3D = Object3D.mergeAll(GroupOfModels3D);;//<----- removing this line fixes the issue

GLSLShader blendingShader = new  GLSLShader( Loader.loadTextFile(res.openRawResource(R.raw.vertexshader)),Loader.loadTextFile(res.openRawResource(R.raw.fragmentshader)));

//assign vertex colors
 int  numberOfVertices = object3D.getMesh().getUniqueVertexCount();
  float[]     offScreenColorArray = new float[numberOfVertices * 4];

  for (int i = 0; i < offScreenColorArray.length; i++) {

  offScreenColorArray[i] = 0.0f;

  if (i > 0) {

  if (i % 4 == 0)
  offScreenColorArray[i] = 0; //red color

  if (i % 4 == 1)
  offScreenColorArray[i] = 0;//green color

  if (i % 4 == 2)
  offScreenColorArray[i] = 1;//blue color

  if (i % 4 == 3)
  offScreenColorArray[i] = 1; //transparency
  // 1-> opaque 0-> total
  // transparent
        vattrs = new VertexAttributes("colorinfo",offScreenColorArray,VertexAttributes.TYPE_FOUR_FLOATS);

At the beginning the object is rendered without using the blendingShader GLSLShader with no problem.

But later on run time i want to use the blendingShader  with a different array of color (red ) like this one:

Code: [Select]

int numberOfVertices = object3D.getMesh().getUniqueVertexCount();

        for(int i = 0; i < fixedColor.length; i++){
        fixedColor[i] = 0.0f;
              if(i%4 == 0)
              fixedColor[i] = 1;//red color
              if(i%4 == 1)
              fixedColor[i] = 0; //green color
              if(i%4 == 2)
              fixedColor[i] = 0; //blue color
              if(i%4 == 3)
              fixedColor[i] = 1;   //transparency

After i assign the new color i call the following lines:

Code: [Select]
      vattrs.update(fixedColor, 0);

But in this case the object3D is rendered with blue color (offScreenColorArray) instead of red color (fixedColor)

After a lot of hours i found out that if i remove the call of at the beginning, the object3d is rendered with red color  (fixedcolor array)

The used shaders are:

Code: [Select]
//------------------------------- vertexshader -------------------------

attribute vec4 colorinfo;
uniform mat4 modelViewProjectionMatrix;
attribute vec4 position;
varying vec4 vertexColor;

void main(void)
     vertexColor = colorinfo;
     gl_Position = modelViewProjectionMatrix * position;


Code: [Select]
//-------------------------------- fragmentshader -------------------
varying vec4 theColor;
varying vec4 vertexColor;

void main(void)
 gl_FragColor = vertexColor;

What is the problem?

Thanks in Advance

Support / Re: Off screen rendering
« on: April 18, 2015, 11:30:32 pm »

Hi ,

i just tested the FrameBuffer.getPixels() method of the

It is much faster now.

The previews getPixels() for a screen 1794 x 1080 of Nexus 5 had around 1100 ms process time
and the new one has around 140 ms.

Is a great difference!!!

Many thanks :)

Support / Re: Off screen rendering
« on: April 15, 2015, 09:32:42 am »

I will try the updated version and I let you know about the results.

Many thanks :)

Support / Re: Off screen rendering
« on: April 13, 2015, 10:04:15 pm »

Ok thanks.

But the jpct_ae.jar supports the Object3D constructor with normals?

Object3D(float[] coordinates, float[] normals, float[] uvs, int[] indices, int textureId)

You had created a special version of jpct_ae.jar for me.

Thanks in advance.

Pages: 1 [2] 3 4 ... 6