Skip to main content
gamedev.net
🔒 Locked

Problems with model's textures

Started by Olek Feb 2, 2004 at 12:56 PM 7 replies 450+ views
Original Post
Olek
Olek
Hello everybody, I''m creating a little game using OpenGL and I wanted to put some MilkShape 3D models into it. I have several such objects and I''m able to draw them properly, but only one of this objects is textured. All the rest is drawn in white, despite the textures are defined for them. Is this a problem with texture bitmaps (I mean file format, size or something?) or rather implementation problem? Does anyone have idea how to deal with it? Thanks for help in advance, Olek
Olek, olo_b@poczta.onet.pl.
CodeMunkie
CodeMunkie
Could be either, could be both, could be something else entirely. Post some code.
"When you die, if you get a choice between going to regular heaven or pie heaven, choose pie heaven. It might be a trick, but if it's not, mmmmmmm, boy."
How to Ask Questions the Smart Way.
Olek
Olek
If you talking about the code that loads the models and draw them it''s too big to post it here. But I''m using the files from NeHe page so I could give you the link - http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=31
As I said one object is drawn correctly but the rest isn''t. They are displayed without any textures on them (in white color). The files I''m using from that tutorial should be fine I suppose, so maybe it''s not a programming problem but anyway I would be grateful for solution.

Olek
Olek, olo_b@poczta.onet.pl.
Megahertz
Megahertz
What happens if you use one of the other loaded textures to draw that first object? Does the texture show up? Might help narrow down the problem.

White textures usually indicate a problem with either the texture loading routines or the creation of the texutres.

-=[ Megahertz ]=-
-=[Megahertz]=-
Olek
Olek
The object which is drawn properlu uses only one texture and I have tried this texture on the other objects too, but it didn''t work with the rest.

Olek
Olek, olo_b@poczta.onet.pl.
CodeMunkie
CodeMunkie
Are you binding the texture before drawing each object? Are you for some reason disabling textures before drawing the other objects? Do you have a light source? Is your light source somehow "washing out" the texture?
"When you die, if you get a choice between going to regular heaven or pie heaven, choose pie heaven. It might be a trick, but if it's not, mmmmmmm, boy."
How to Ask Questions the Smart Way.
Olek
Olek
I think that there''s something wrong with the code I took from the link previously posted. When I deleted three lines of code that was disabling the textures when their count was >0 the all objects were textured, but they had the same textures as objects drawn before them (and not the textures they should have) which is quite annoying.
Anyone have idea what could be wrong with the code?
Olek, olo_b@poczta.onet.pl.
CodeMunkie
CodeMunkie
If you want each object to have a unique texture, you have to bind a different texture object before drawing each object. Something to the tune of:

glBindTexture(GL_TEXTURE2D, water);
glCallList(waterList);//draw water

glBindTexture(GL_TEXTURE2D, ground);
glCallList(groundList);//draw ground

glBindTexture(GL_TEXTURE2D, sky);
glCallList(skyList);//draw sky

For simplicity, the display lists contain the drawing instructions. Just note that a different texture object was used during each glBindTexture and the bind occured right before the object was drawn. Hope that gives you something to compare with your code.
"When you die, if you get a choice between going to regular heaven or pie heaven, choose pie heaven. It might be a trick, but if it's not, mmmmmmm, boy."
How to Ask Questions the Smart Way.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.