Page 1 of 2

loading .bin models from nitrodir

Posted: Tue May 06, 2014 3:45 pm
by t377y000
hi i have been trying to find a way to load this .bin model "basiccubeX64.bin with nitrodir.
(basically a .x model converted with n"ds model exporter" to .bin)

here is the source im attempting with.
FILE *pFile; char * buffer; size_t dataInFile; long fileSize;

pFile = fopen("basiccubeX64.bin", "rb");
fseek(pFile, 0, SEEK_END);
fileSize = ftell(pFile);
rewind(pFile);
buffer = (char*)malloc(fileSize+1); //buffer = (char*) malloc (sizeof(char)*fileSize);
dataInFile = fread(buffer, 1, fileSize, pFile);
fclose(pFile); //free(buffer);

glPushMatrix();
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
get_glPolyFormats(); get_glMats();
glTranslatef(0,0,0); glRotateX(-90); glScalef(10,10,10);
glBindTexture( 0,house2tex64_texid); glCallList((u32*)dataInFile);
glPopMatrix(1);
im also using these includes.
#include <filesystem.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>

Re: loading .bin models from nitrodir

Posted: Sat May 10, 2014 8:19 pm
by t377y000
bump? anyone?

Re: loading .bin models from nitrodir

Posted: Tue May 13, 2014 4:09 am
by elhobbs
I think you will have better luck with a response if you ask an actual question or describe the problems you are experiencing.

Re: loading .bin models from nitrodir

Posted: Thu May 15, 2014 8:03 am
by t377y000
The question how do I load the .bin models converted with nds model exporter.exe.
The problem is when I boot the game an error says glCallList is null.

Re: loading .bin models from nitrodir

Posted: Fri May 16, 2014 7:30 am
by elhobbs
For starters fread returns the number of elements read - not a pointer to data.

Re: loading .bin models from nitrodir

Posted: Tue May 20, 2014 12:14 am
by t377y000
so how would i fix this? i'm puzzled at the moment.

Re: loading .bin models from nitrodir

Posted: Tue May 20, 2014 10:46 am
by WinterMute
With the code you posted :-

Code: Select all

-glBindTexture( 0,house2tex64_texid); glCallList((u32*)dataInFile);
+glBindTexture( 0,house2tex64_texid); glCallList((u32*)buffer);

Re: loading .bin models from nitrodir

Posted: Tue May 20, 2014 6:57 pm
by t377y000
hmm still nothing with desmume i get a black screen, with nocashgba i get invalid gx command popups.
heres a screencap.
Image

& heres another with the code moved around
Image

Re: loading .bin models from nitrodir

Posted: Tue May 20, 2014 9:24 pm
by t377y000

Re: loading .bin models from nitrodir

Posted: Thu May 22, 2014 6:01 am
by t377y000
well still no luck guys. i moved the FILE part form the loop