#167999 - opearn - Mon Apr 06, 2009 2:38 pm
hi every one,
i'm trying to load and texture multiple 3D models on the nds,
errors:
my ground model isn't being drawn,
and the enemys texture dosn't wrap the entire model
i think the main error is with the tex_scale....
(i'm not really sure what to set tex_scale to so i ended up copying from an example)
the following is an extract from my code.
thanks for your help,
-opearn
i'm trying to load and texture multiple 3D models on the nds,
errors:
my ground model isn't being drawn,
and the enemys texture dosn't wrap the entire model
i think the main error is with the tex_scale....
(i'm not really sure what to set tex_scale to so i ended up copying from an example)
the following is an extract from my code.
Code: |
GLvector tex_scale = { 64<<16, -64<<16, 1<<16 };
GLvector tex_scale2 = { 64<<16, -64<<16, 1<<16 }; glMatrixMode(GL_MODELVIEW); glLoadIdentity(); //draw all our models //ground //position variables glMatrixMode(GL_TEXTURE); glLoadIdentity(); glScalev( &tex_scale2 ); //scale normals up from (-1,1) range into texcoords glRotateXi(0); glRotateYi(0); glMatrixMode(GL_POSITION); glLoadIdentity(); glTranslate3f32(0,0,floattof32(0)); // x,y,z glRotateXi(0); glRotateYi(0); glMaterialf(GL_EMISSION, RGB15(31,31,31)); glPolyFmt(POLY_ALPHA(31) | POLY_ID(8) | POLY_CULL_BACK | POLY_FORMAT_LIGHT0); glBindTexture(0, texture[0]); //wrap texture (non functional) glCallList((u32*)ground_model_bin); //draw model //enemy //position variables glMatrixMode(GL_TEXTURE); glLoadIdentity(); glScalev( &tex_scale ); //scale normals up from (-1,1) range into texcoords glRotateXi(0); glRotateYi(0); glMatrixMode(GL_POSITION); glLoadIdentity(); glTranslate3f32(p2x,p2y,floattof32(p2z)); // x,y,z glRotateXi(p2rotx); //xrot glRotateYi(p2roty); //yrot glMaterialf(GL_EMISSION, RGB15(31,31,31)); glPolyFmt(POLY_ALPHA(31) | POLY_ID(8) | POLY_CULL_BACK | POLY_FORMAT_LIGHT0); glBindTexture(0, texture[3]); //wrap texture (non functional) glCallList((u32*)enemy_model_bin); //draw model |
thanks for your help,
-opearn