StrikerBlueI
Still Fresh
- Joined
- Jun 28, 2006
- Messages
- 3
I have written a 3D Engine (not complete yet). It's called GMath3D. I am using the fread() function to load data from a polygon data file. This function seems to work flawlessly when used in my 3D editor in Windows, but when I try and load the polygon data into my gp2x program, my system freezes. The code used to load the data is shown below.
I have read elsewhere that fread can load arrays of struct (data types). When this code is used in my gp2x app, it seems to load data as all 0's (zeros or NULL); What might be the problem here.
void G3D_LoadModel(char* file, Model3D model, PolyPoint3D *tri, DeltaList3D *delta)
{
FILE *fp;
fp = fopen(file, "r");
fread(&model, sizeof(Model3D), 1, fp);
fread(tri, sizeof(PolyPoint3D), model.mPoints, fp);
fread(delta, sizeof(DeltaList3D), model.mPanels, fp);
fclose(fp);
}
I have read elsewhere that fread can load arrays of struct (data types). When this code is used in my gp2x app, it seems to load data as all 0's (zeros or NULL); What might be the problem here.
void G3D_LoadModel(char* file, Model3D model, PolyPoint3D *tri, DeltaList3D *delta)
{
FILE *fp;
fp = fopen(file, "r");
fread(&model, sizeof(Model3D), 1, fp);
fread(tri, sizeof(PolyPoint3D), model.mPoints, fp);
fread(delta, sizeof(DeltaList3D), model.mPanels, fp);
fclose(fp);
}