Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamic load a 3d model from a file located in a webserver
    primarykey
    data
    text
    <p>I will like to make an App that will display a 3d model from a file.</p> <p>I know already to create an App that display a 3d model like a banana which is part of the App in a .h header file. </p> <p>But I will like to do is to make a small list of 3d objects to display in the App and when the user choose a model it will be uploaded from the local webserver into the phone and then the phone render it.</p> <p>What I do no know what to do is to do the dynamic programming that load the 3d model and display it.</p> <hr> <p>I have done a test, I have edited with the WordPad in Windows on my Local Webserver a file banana.h which contains a list of float arrays in order to extract one array and create a text file named ObjVerts.txt</p> <p>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.</p> <p>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 work.</p> <p>It seem that the last statement return nothing!</p> <p>Please I would appreciate if you can guide me a bit more.</p> <p>Here the piece of code I did try :</p> <pre><code> 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"); } </code></pre> <p>thanks Regis</p> <hr> <p>This works and return me some data but I do not know how to transform the result to a GLfloat array:</p> <pre><code> NSURL *myurl = [NSURL URLWithString:@"http://localhost/ObjVerts.txt"]; NSData *mystring = [NSData dataWithContentsOfURL:myurl]; glVertexAttribPointer(vertexHandle, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) mystring[0]); </code></pre> <p>thanks Regis</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload