[help] Textures on 3D models.

Post Reply
opearn
Posts: 23
Joined: Tue Feb 17, 2009 11:29 am

[help] Textures on 3D models.

Post by opearn » Wed Apr 01, 2009 1:15 pm

UPDATED:hi everyone,
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....

Code: Select all

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
-opearn
Last edited by opearn on Mon Apr 06, 2009 12:29 pm, edited 2 times in total.

weirdfox
Posts: 29
Joined: Thu Feb 19, 2009 8:45 am
Location: Montreal, Canada
Contact:

Re: [help] Textures on 3D models.

Post by weirdfox » Thu Apr 02, 2009 9:42 pm

As you set your glMatrixMode to GL_TEXTURE to alter the texture render, mybe returning the glMatrixMode to GL_MODELVIEW befor calling the CallList could help.

I think it's worth a try :)
try, crash, debug and learn :)

opearn
Posts: 23
Joined: Tue Feb 17, 2009 11:29 am

Re: [help] Textures on 3D models.

Post by opearn » Mon Apr 06, 2009 12:29 pm

I updated the first post.

so can anyone please help me?

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 7 guests