Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a change in Qualcomm's Vuforia Sample App

I have been looking through the threads at the Qualcomm Forums but no luck since I don't know exactly how to look for what I want.

I'm working with the ImageTargets Sample for iOS and I want to change the teapot to another image (a text rather) I had.

I already have the render and I got the .h using opengl library but I can't figure out what do I need to change to make this work and since this is the very basic and I haven't been able to make it work I really haven't ventured to try anything else.

Could anyone please help me out?

I would paste code here but it's a whole project so I don't know exactly what to put if needed please let me know.

like image 668
Tsundoku Avatar asked Feb 11 '12 03:02

Tsundoku


3 Answers

If the case is still valid, here's what you have to do:

  1. get header file for 3D object
  2. get texture image for this object
  3. in EAGLView.mm make this changes:

    • import "yourobject3d.h"
    • add your texture to textureFilenames array(this should be at the begining of EAGLView
    • eventually take care about kObjectScale (by deafult it was about 3.0f, for one object I did have to change it even up to 120.0f)
    • in setup3dObjects method assign proper arrays of vertices/normals/texture coords (check in "yourobject3d.h" file for proper arrays and naming) to Object3D *object
    • make this change in renderFrameQCAR

      //glDrawElements(GL_TRIANGLES, obj3D.numIndices, GL_UNSIGNED_SHORT, (const GLvoid*)obj3D.indices);
      glDrawArrays(GL_TRIANGLES, 0, obj3D.numVertices);
      

I believe that is all... if something take a look at Vuforia's forum, i.e. here: https://developer.vuforia.com/node/2047669

NOTE: default teapot.h does (!) have indices, which are not present in banana.h (from comment below) so take care about that too

like image 72
raistlin Avatar answered Nov 20 '22 05:11

raistlin


Have a look at the EAGLView.mm file. There you'll have to load the textures (images) and 3d objects (you'll need to import your .h instead of teapot.h and modify setup3dObjects accordingly).

They are finally rendered by calling the renderFrameQCAR function.

like image 4
Daniel Bang Avatar answered Nov 20 '22 04:11

Daniel Bang


Actually, teapot is not an image. It's a 3D model stored in .h format which includes Vertices, Normals, and Texture coordinates. You should have a good knowledge of OpenGL ES to understand those codes in sample app.

An easier way to change the 3D model to whatever you want is to use a rendering engine which facilitates the drawing and rendering stuffs and you don't need to bother OpenGL APIs. I've done it with jPCT-AE for Android platform but for iOS there is a counterpart called OpenFrameworks engine. It has some plugins to load 3Ds or MD2 files and since it's written in C++ you can easily integrate it with QCAR.

This is a short video of my result with jPCT and QCAR: Qualcomm Vuforia + jPCT-AE test video

like image 3
Sam R. Avatar answered Nov 20 '22 06:11

Sam R.