Jump to content
  • Advertisement
Sign in to follow this  
Tasaq

Texture problem with 3DS file

This topic is 2591 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have imported a textured model form 3ds max using loader that can be found HERE. My problem is that when i use it in a class texures are missing, but when I use it normaly everything is ok.
Here's a screenshot what's happening:
texprob.jpg
The one on the left is loaded in the class enemy...
constructor
enemy::enemy(char* model, char* texture, float lif, float point, bool weapo){
ene.Load(model);
....
}


display method:
void enemy::edraw(int ind){
if(alive[ind]==false){
}
else{
glPushMatrix();
glMaterialf(GL_FRONT, GL_SPECULAR, 1.0);
GLfloat shine[4]={128, 100, 100, 1};
glMaterialf(GL_FRONT, GL_DIFFUSE, 1);
glMaterialfv(GL_FRONT, GL_SHININESS, shine);
ene.Objects[1].rot.y+=20;
ene.Objects[0].rot.x=180;
glColor3f(0.7f,0.7f,0.7f);
glScalef(0.01,0.01,0.01);
glRotatef(-15, 0,1,0);
ene.Draw();
glPopMatrix();
}
}

That's for enemy class, I have class CGL, where i have method void CGL::draw_enemy(); which looks same as one above (I used it before i created enemy class for tests);
in CGL class I have my Init and Display.
init:
void CGL::init( void ) {
copter.Load("objects/copter.3DS");
enemy kulkocopter("objects/copter.3DS", "objects/muz.BMP", 5, 100, false);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective( 50, 1, 1, 1000);
gluLookAt( 0, 0, 7, 0, 0, 0, 0, 1, 0 );
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glEnable( GL_DEPTH_TEST );
glEnable( GL_NORMALIZE );
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_NORMALIZE);
glEnable(GL_COLOR_MATERIAL);
glDepthFunc(GL_LEQUAL );
glClearColor( 0.2f, 0.6f, 1.0f, 1.0f );
glEnable(GL_TEXTURE_2D);
glShadeModel( GL_SMOOTH );
}

display:
void CGL::display(){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glPushMatrix();
glPushMatrix();
glTranslatef(1.0, 0.0, 0.0);
kulkocopter.edraw(0);
glPopMatrix();
draw_enemy();
glPopMatrix();
glutSwapBuffers();
glutPostRedisplay();
}

Note that I cut the unnecessary parts of code here(like drawing a wall behind or a plane, because when i comment them out problem is still present).
Thanks for all help in advance :)

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!