I will like to create an demo that load the models from a small local web server.
How can I do this, please ?
In the interests of saving you a lot of time and effort, you would be better off using Unity.
Cocos integration is a lot of work and it will be difficult to get it to work in a stable manner.
I have found this example which can help others, but there are 2 errors on it upon compiling :-(
I have Xcode 4.6 and an Iphone 5 on iOS 6.1
It is located here : http://www.cocos2d-iphone.org/forum/topic/31918?replies=26#post-372580
The direct link for the demo is here :https://www.dropbox.com/s/edrlvwwlcej5xan/QCARExperiment-cube.zip
Even a youtube video show the demo running.
Can someone can fix it ?
Hi, cocos3D is built on top of OpenGL ES, so it should work;
someone else seems to have integrated it successfully (both cocos2d and cocos3d), as discussed in this thread:
Hi, from a technical point of view, there is nothing to prevent it from working, I believe it can be done.
From a more "practical" point of view, you will be limited to build 3D models that are a combination of those building blocks; but if that's compatible with the use case you have in mind, it can be a good idea.
Hi finally my idea was bad!
Because transmitting a 3D model over the web Requires to transfer a lot of data!
Like banana.h Consume about 4 meg, Imagine a person that have a small monthly contract like 500 megs.
It consume all is data plan rapidly.
So I think the better solution is to make a Hybrid solution.
I was thinking of storing in the phone 3-D components a bit like Lego blocks.
Then I just need to assemble the parts,move them, rotate them... In order to make a full 3d model!
Is it feasible?
I have done a test, I have edited with the WordPad in Windows on my Local Webserver the file banana.h in order to extract one array and create a text file named ObjVerts.txt
I have done a lot of search in the Web in order to find a small piece of code that can read the text file and convert it to a float array but I did not find any.
I have found a lot of piece of code that read the file and make a NSSMutuableData but many of the code seem to not worrk.
It seem that the last statement return nothing!
Please I would appreciate if you can guide me a bit more.
Here the piece of code I did try :
NSURLRequest *request2 = [NSURLRequest requestWithURL:[NSURL
NSURLConnection *connection2=[[NSURLConnection alloc] initWithRequest:request2 delegate:self];
NSMutableData *response2 = [[NSMutableData data2] retain];
glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) response2);
NSLog(@"Could not create connection");
The rendering of the 3D model is done in the code where the functions glVertexAttribPointer and glDrawElements (or glDrawArray) are used; those functions use your vertex arrrays (vertices, normals, texture coordinates, ...) to make the rendering of the mesh representing your model;
so, your 3D model is represented essentially by those vertex arrays; you can create some < float >arrays at compile time, and then allocate them when you read a model from text (.h) file. Then you pass those arrays to glVertexAttribPointer and so on.
For this kind of issues, reading a good tutorial on OpenGL will certainly help too (because you need to master these concepts a bit before starting thinking of the actual implementation).
Sorry to border you.
What I do not understand, is when the 3D model is received in memory by the App.
How can it uses it in order to generate the 3d model ?
Because, as per my understanding, I cannot make any reference to a 3D object when I compile the App.
Can you guide me to some reading or to something that has been done that it is similar to what I want to do, so I can understand ?
OK, if I understand well I create my program without any .h which represent my 3d model.
Then when the user take a pic with the camera, it will be used as a target model.
Then the user select a 3d model from a list, when the selection is done, a routine connect to the web server and download to the Apps in text format .h the 3d model.
Do I need to create at first in the Apps, a dummy .h with dummy vertices and when the file .h will be loaded it will have the same name as the dummy so all the parameters will be aldy fine and the #d model will display ok.
Did I missed something ?
If so please explain to me please ?
I see. So, since you want to load them at runtime, you cannot use the .h files to compile the project beforehand; in this case you will need to load the .h file and read it as a text file and read/parse the vertex arrays that are defined in it, so that you can build your vertex arrays on-the-fly; then you can use those vertex arays in your OpenGL code (pretty much the same way it is done now in the samples)
For test purpose, for iOS, if the file is already on .h format stored on the server.
What I will like to do is to assign a taken picture as a target and assign a model that I choose from the phone (just a list of models). When the model has been choosen it is uploaded to the phone. So after every times that the program will see the picture the model appear a bit like the user defined target demo.
Hi, this is a very broad question; you may want to search on Android-specific or iOS-specific forums for the web server related part;
once you manage to download files to your device (for instance by storing them into the sdcard of your device), you may want to consider implementing a parser for the specific file format (for instance if your models are in OBJ format, you will need to have a C++ parser/interpreter for such format in order to generate the vertex arrays which are required for rendering in OpenGL).
A much simpler alternative would be to use Unity 3D and the Vuforia Unity extension.
Are you sure you want to delete this message?
Are you sure you want to delete this conversation?