Log in or register to post comments

load models from local web server

January 28, 2013 - 5:45pm #1

Hi,

I will like to create an demo that load the models from a small local web server.

How can I do this, please ?

thanks

Regisma

load models from local web server

February 7, 2013 - 6:48am #17

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.

N

load models from local web server

February 6, 2013 - 5:32am #16

Hi,

Thanks.

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 ? 

Thanks

Regis

load models from local web server

February 6, 2013 - 4:25am #15

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:

https://developer.vuforia.com/forum/ios/cocos2d-and-qcar-project-integration

 

load models from local web server

February 6, 2013 - 4:19am #14

Hi,

Thanks for the reply.

Does Cocos 3D will work with Vuforia SDK?

It seem a bit more easy to work with my idea.

Thanks

Regis

load models from local web server

February 5, 2013 - 11:11pm #13

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.

load models from local web server

February 5, 2013 - 1:21pm #12

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?

Thanks Regis

load models from local web server

February 2, 2013 - 12:50pm #11

Hi, explaining how to implement a text parser in Objective-C is beyind the scope of this Forum...

 

load models from local web server

February 2, 2013 - 2:24am #10

Hi,

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

                                                              URLWithString:@"http://localhost/ObjVerts.txt"]

                                                 cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0]

        NSURLConnection *connection2=[[NSURLConnection alloc] initWithRequest:request2 delegate:self];

        if (connection2)

        {

            NSMutableData *response2 = [[NSMutableData data2] retain];

            glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) response2);

        }

        else

        {

            NSLog(@"Could not create connection");

        }

 

thanks

Regis

load models from local web server

January 29, 2013 - 11:15pm #9

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).

 

load models from local web server

January 29, 2013 - 3:09pm #8

Hi,

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 ?

many thanks

Regis

load models from local web server

January 29, 2013 - 2:11pm #7

Hi,

ok so when the App is running and it load the 3d model, the .h file and when the program will go in the routine to draw the model, I should see it right ?

 

thanks

 

Regisma

load models from local web server

January 29, 2013 - 1:42pm #6

Hi, that sounds correct; concerning your question about using a dummy .h file, this is not necessary (and anyway it is just a C++ implementation detail; up to you how to handle it)

 

load models from local web server

January 29, 2013 - 12:32pm #5

Hi,

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 ?

thanks

Regis

load models from local web server

January 29, 2013 - 5:57am #4

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)

 

load models from local web server

January 29, 2013 - 3:45am #3

Hi,

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.

thanks

Regis

load models from local web server

January 29, 2013 - 1:03am #2

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.

Log in or register to post comments