texture question
Hi, I''m using the MD2 model-loading source from the GL Book in the same scene as another class I''ve made. This other class takes a pointer to another class that ends up calling glTexImage2D(). Anyway, the models display fine until I introduce my homemade class into the scene.
I have a "guy" and a "gun" in my scene. Your random every-day enemy .md2, and his gun also in form of md2.
The guy draws fine, but the gun is covered in the texture I used in my class (a grass texture for the terrain), instead of the actual gun texture. My class simply uses glTexImage2D() to apply the texture, and then draws a series of quads. I am not sure why its texture is making itself persistant and is being displayed when some other texture is supposed to. I hope I have been semi-clear, and I''ve run out of places to ask. Please ask me if you have any uncertanties, I''d really like some help. Thanks.
It sounds like you are using the same texture ID when you load the grass texture as for when you load the gun texture. Make sure they are different.
I was never taught to use glBindTexture, if this is what you are referring to. Instead (at school) we designed a class that has a pointer to the image data and simply applies the texture. We instantiate a variable of this type and call its member function glTexImage2D() which then calls ::glTexImage2D(...). Nowhere do we call glBindTexture(). Should I call glBindTexture() with a new index num before I load my models?
-rw
-rw
Hope this helps, I added two more MD2s to the scene...
DisplayMD2Interpolate(guy);
DisplayMD2Interpolate(gun);
glTranslated(30, 0, 0);
DisplayMD2Interpolate(sodguy);
DisplayMD2Interpolate(sodgun);
glPopMatrix();
static GLBitmap g("grass.bmp");
glPushMatrix();
g.glTexImage2D();
It seems that whatever is the LAST MD2 to be drawn is covered in the grass texture. What would cause this?
DisplayMD2Interpolate(guy);
DisplayMD2Interpolate(gun);
glTranslated(30, 0, 0);
DisplayMD2Interpolate(sodguy);
DisplayMD2Interpolate(sodgun);
glPopMatrix();
static GLBitmap g("grass.bmp");
glPushMatrix();
g.glTexImage2D();
It seems that whatever is the LAST MD2 to be drawn is covered in the grass texture. What would cause this?
You have to do a GenTextures for a unique ID, and a bind for every texture you load.
Then a bind and render for each one drawn with.
zin
zintel.com - 3d graphics & more or less
Then a bind and render for each one drawn with.
zin
zintel.com - 3d graphics & more or less
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement