need help loading 3ds in cocoa
Oh, that's tough. Well, just try the same code, it might just work (yeah right
)
)
Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
load into a four-byte integer, do the swap as is, then get the float out like this:
or like this:
Code:
float my_float = *(const float *)&my_four_byte_integer;or like this:
Code:
typedef union
{
uint32_t integer;
float float;
}
four_byte_float;
four_byte_float f;
f.integer = my_four_byte_integer;
float my_float = f.float;
ok next question: why cant cocoa display the strings contained in the file properly? (it always says something like \\302)
How are you loading them
first i load the file into a char buffer, then i do something along the lines of this:
char *tempName;
tempName = new char[chunkLength];
for(int j = 0; j<chunkLength; j++)
tempName[j] = *(char*)(buffer+j);
chunkLength is the length of the string
char *tempName;
tempName = new char[chunkLength];
for(int j = 0; j<chunkLength; j++)
tempName[j] = *(char*)(buffer+j);
chunkLength is the length of the string
What's the type of buffer?
How are you printing them?
How are you printing them?
the buffer is a pointer to char
i print with NSLog ex. NSLog(@"string:%c", tempName);
i print with NSLog ex. NSLog(@"string:%c", tempName);
%c is for characters, right? There should be a separate conversion for strings. I'll look it up...
Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
%s for regular char* strings, %S for unicode.
Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
ok another stupid question: how do i get just one byte from the buffer and find the ascii value of it?
btw sorry for all these silly questions, im still getting used to weird cocoa and i was never really an expert in c/c++ anyway.
btw sorry for all these silly questions, im still getting used to weird cocoa and i was never really an expert in c/c++ anyway.
buffer[i] if buffer's a const char* containing ascii, and i is the index of the character you want...
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Texture Loading in Cocoa... | dave05 | 3 | 7,671 |
Dec 11, 2007 03:12 AM Last Post: DoG |
|
| Loading and using textures with alpha in OpenGL with Cocoa | corporatenewt | 4 | 5,077 |
Dec 8, 2007 02:06 PM Last Post: Malarkey |
|
| loading textures - cocoa openGL | mDmarco | 20 | 8,330 |
Aug 28, 2007 08:48 PM Last Post: OneSadCookie |
|
| Cocoa Texture Loading Code Problem | Nick | 1 | 2,776 |
Oct 28, 2005 11:44 PM Last Post: OneSadCookie |
|
| Quick texture loading in Cocoa? | Fenris | 20 | 7,640 |
Jun 10, 2003 03:18 AM Last Post: Fenris |
|

