I am trying to put every thing on the internet and download it on the go, including the xml , dat and the model data & texture. Walk through a long road, I managed to download all of them now. Switching dataset is a no problem, but when it comes to the model. I run into something I have no idea of.
My model data is coming from an XML and I first store it in a NSString. It looks like something like this :
The normal data and texture coordinate data are obtained in the same way too.
P.S. I use all the data from the example teapot, just to make sure if I did it all right, I can see the teapot.
Then in the setup3dObjects function, I modify thing like this:
float *modelVertices = (float *) malloc(sizeof(float) * ((modelObject.numVerts*3))); //separate the values by comma NSArray * array = [modelObject.vertData componentsSeparatedByString:@","]; for (int i =0 ; i < (modelObject.numVerts*3); i++) { //get the string and convert to float number modelVertices[i] = [[array objectAtIndex:i] floatValue]; } obj3D.vertices = modelVertices;
But finally, I got this when the image target is detected:
The teapot is now many pieces of triangles roughly assembling in a teapot shape. Checked that the float values converted from the strings in the above code is the same as the one in the example teapot.h.
Any ideas on what I did wrong?
Please help, I am so frustrated on this. I am very new to 3D/OpenGL things:(
Hi Patrick,
I'm walking on the similar road you walked through. I'm dowloading the datasets at runtime. My problem is that I don't know how to switch datasets runtime. Actually in a dataset I have the data for only one trackable. When I start the Vuforia's AR view fisrt time in the app everything is ok. After that I quit the Vuforia's AR view. When the AR view starts again the new dataset should be loaded. I don't know how to switch the datasets. Could you help me, please?