Log in or register to post comments

Remove Rendering Part

June 3, 2013 - 3:41am #1


I'm building my app based on the ImageTargets sample. I just want to replace the entire rendering part by my own logic (I'll transform Android Views instead of rendering 3D objects). So I need to remove rendering, surface, preview, textures, overlays, etc.

The problem is that Tracking and Rendering modules seem to be deeply integrated into each other. Whenever I remove some rendering part the entire app stops to work (I check it using debug logs).

  • Is there any example of basic tracking w/o any output?
  • What parts of the code can I remove?
  • What parts should remain?

I know my questions are very general, but any direction would be appreciated.


Remove Rendering Part

June 3, 2013 - 7:02am #5

Thanks a lot.

I'll take it from here.

Remove Rendering Part

June 3, 2013 - 5:21am #4

Having a surface is not a MUST, you should be able to remove the GL view;

however, this would require checking carefully all the code that somehow refers to the OpenGL view and adjust it (both in Java and ++);

this is possible to do, but it would require a bit of patience (and we don't have a step by step tutorial for that); 

An easier way would be to leave the OpenGL code as it is in the sample, but simply set the mGLView to INVISIBLE.


Remove Rendering Part

June 3, 2013 - 4:21am #3

Thanks for the answer, Alessandro.

Actualy, I have already commented the renderFrame call and have extracted the matrix within the onUpdate function (thanks to your example How can I access the camera image).

Now I want to remove all the irrelevant code. When I try to remove mGlView, for example, the app stops to work - tried to comment this line in ImageTargets.java:

addContentView(mGlView, new LayoutParams(LayoutParams.MATCH_PARENT, 

The same when I try to comment the following line in the same file:


EDIT: Just found the following comment:

                // Now add the GL surface view. It is important
                // that the OpenGL ES surface view gets added
                // BEFORE the camera is started and video
                // background is configured.
                addContentView(mGlView, new LayoutParams(LayoutParams.MATCH_PARENT,

I guess having a surface is a MUST?

Remove Rendering Part

June 3, 2013 - 3:49am #2

Hi, the relevant rendering code is in the renderFrame() function in ImageTargets.cpp file (in the JNI folder);

that function performs two things:

- performs rendering

- retrieve the pose matrix of each image target detected in the current frame

Note: the renderFrame() function is declared as native method in ImageTargetsRenderer.java, and called from within the onDrawFrame() method of the ImageTargetsRenderer class.

If you want to remove the rendering part, you may want to suppress the call to renderFrame();

if you then need to retrieve the target Pose matrix, you may be ablt to do that by putting the tracking specific code in the QCAR_onUpdate() method (which is called once per frame, i.e. whenever a new camera frame is processed by QCAR,  but has no relationship with rendering).

Hope this helps.

Log in or register to post comments