Log in or register to post comments

Convert from obj to .h file (Urgent) ... please answer me

March 28, 2012 - 9:03am #1

Dear all,
I need to convert my obj file to .h file to have the following arrays like teapot example:

- numVertices
- vertices
- normals
- texCoords
- numIndices
- indices

I used the obj2opengl script but it doesn't solved my problem I searched but i didn't find any answer How can i generate .h file to meet the requirements of "Vuforia SDK"? (like
teapot.h)

Thank you

Convert from obj to .h file (Urgent) ... please answer me

August 15, 2012 - 6:54pm #10

Please post to https://ar.qualcomm.at/content/convert-obj-h-file-urgent-please-answer-me so that we can consolidate responses.

Convert from obj to .h file (Urgent) ... please answer me

August 15, 2012 - 10:29am #9

Hi,

I exported the 3d model with the vertices and normals only and converted it into .h file using obj2openpl by Heinko.

Heres is the link to my model and .h file (in PoseModel.zip):

https://www.dropbox.com/sh/mz2ac79wnormm6d/zTHAem-y2W 

Here the output of ndk-build:

Gdbserver      : [arm-linux-androideabi-4.6] libs/armeabi/gdbserver

Gdbsetup       : libs/armeabi/gdb.setup

Gdbserver      : [arm-linux-androideabi-4.6] libs/armeabi-v7a/gdbserver

Gdbsetup       : libs/armeabi-v7a/gdb.setup

Compile++ arm    : ImageTargets <= ImageTargets.cpp

In file included from jni/ImageTargets.cpp:45:0:

jni/./posefour.h:33941:9: error: "vertices" is not a valid filename

jni/./posefour.h:67851:9: error: "vertex" is not a valid filename

jni/./posefour.h:135608:9: error: "faces" is not a valid filename

jni/./posefour.h:169532:9: error: "vertices" is not a valid filename

jni/./posefour.h:203442:9: error: "vertex" is not a valid filename

jni/./posefour.h:271199:9: error: "faces" is not a valid filename

In file included from jni/ImageTargets.cpp:15:0:

/Users/harshvardhan/Documents/Work/app/android-ndk-r8b/platforms/android-14/arch-arm/usr/include/jni.h:592:13: note: the mangling of 'va_list' has changed in GCC 4.4

In file included from jni/ImageTargets.cpp:45:0:

jni/./posefour.h:27:1: error: 'mtllib' was not declared in this scope

jni/./posefour.h:27:8: error: expected '}' before 'posefour'

jni/./posefour.h:27:8: error: expected ',' or ';' before 'posefour'

jni/./posefour.h:135613:1: error: expected declaration before '}' token

make: *** [obj/local/armeabi/objs-debug/ImageTargets/ImageTargets.o] Error 1


I still think that something is wrong with the 3d model only. Heinko mentioned a problem with 3ds max exporting script.

Should I delete the gw_objexp.ini or something else..any clue would be a great help..??

Re: Convert from obj to .h file (Urgent) ... please answer me

April 12, 2012 - 4:17am #8

Reply deleted.

Sorry, I had a problem with the Perl script.

Re: Convert from obj to .h file (Urgent) ... please answer me

April 2, 2012 - 2:21am #7

You should really have a basic knowledge of OpenGL to develop with Vuforia.

Try looking at the ImageTargets.cpp file in the jni directory, there in the renderFrame method you could use:

glRotatef(
GLfloat angle,
GLfloat x,
GLfloat y,
GLfloat z
);

or

SampleUtils::rotatePoseMatrix(
float angle,
float x,
float y,
float z,
float* matrix
);

Re: Convert from obj to .h file (Urgent) ... please answer me

April 1, 2012 - 4:57am #6

Thank you Mr.ksiva
my object now is bigger i was changed the kObjectScale to 90.0f
but my object wasn't Anchored on the marker (like teapot) and it was rotated
how can i solve this?

Thank you

Re: Convert from obj to .h file (Urgent) ... please answer me

March 29, 2012 - 4:03pm #5

Try changing the kObjectScale variable to something bigger.

- Kim

Re: Convert from obj to .h file (Urgent) ... please answer me

March 29, 2012 - 6:35am #4

Thanks for God
the banana object is appear now ... but the problem now is it is very very small
What can i do?

Re: Convert from obj to .h file (Urgent) ... please answer me

March 29, 2012 - 4:30am #3

Thank you Mr.ksiva

i'm do that and the project has been built successfully ...
but when i run the project and detect the target marker it's freez the camera and exit from application and write this error in Xcode:

error: failed to launch '/Users/khaled/Library/Developer/Xcode/DerivedData/ImageTarget-cpiwdvmeppdxbpsiqrmbqnuape/Build/Products/Debug-iphoneos/ImageTargets.app/ImageTargets' -- device locked

What's the problem?

Re: Convert from obj to .h file (Urgent) ... please answer me

March 28, 2012 - 9:07pm #2

Try using glDrawArrays instead of glDrawElements:

glDrawArrays(GL_TRIANGLES, 0, numVerts);

You don't need indices or numIndices in that case.

- Kim

Log in or register to post comments