🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Having Troubles with multiple textures

Started by
11 comments, last by Icewater11 16 years, 8 months ago
its 372 pollies long, but after the beginning its just repetetive:

NUMPOLLIES 372

// Floor 1

-3.0 0.0 -3.0 0.0 6.0
3.0 0.0 -3.0 6.0 6.0
3.0 0.0 3.0 6.0 0.0

// Floor 2
-0.5 0.0 3.0 0.0 1.0
-0.5 0.0 4.0 1.5 1.0
0.5 0.0 3.0 1.5 0.0
-0.5 0.0 4.0 1.5 0.0
0.5 0.0 3.0 0.0 1.0
0.5 0.0 4.0 0.0 0.0

// Floor 3
-0.5 0.0 4.0 0.0 1.0
-0.5 0.0 5.0 1.5 1.0
0.5 0.0 4.0 1.5 0.0
-0.5 0.0 5.0 1.5 0.0
0.5 0.0 4.0 0.0 1.0
0.5 0.0 5.0 0.0 0.0


// Floor 4
-0.5 0.0 5.0 0.0 1.0
-0.5 0.0 6.0 1.5 1.0
0.5 0.0 5.0 1.5 0.0
-0.5 0.0 6.0 1.5 0.0
0.5 0.0 5.0 0.0 1.0
0.5 0.0 6.0 0.0 0.0


// Floor 5
-0.5 0.0 6.0 0.0 1.0
-0.5 0.0 7.0 1.5 1.0
0.5 0.0 6.0 1.5 0.0
-0.5 0.0 7.0 1.5 0.0
0.5 0.0 6.0 0.0 1.0
0.5 0.0 7.0 0.0 0.0


// Floor 6
-0.5 0.0 7.0 0.0 1.0
-0.5 0.0 8.0 1.5 1.0
0.5 0.0 7.0 1.5 0.0
-0.5 0.0 8.0 1.5 0.0
0.5 0.0 7.0 0.0 1.0
0.5 0.0 8.0 0.0 0.0

and so on from there
Advertisement
As it is, I don't see any texture information in the file. So, you'll need to modify the file, the file loader, and your stored poly data. The file needs to store the appropriate texture with each triangle, the loader needs to take this into account and load the texture ID (unsigned int, filename, whathaveyou) into the newly modified triangle container, which now has to keep track of which texture(s) it uses. You don't have to specify the texture for each polygon, just each group of polygons that uses the same texture. So, group your floors by texture and keep assigning polygons the same texture until you encounter a new one.

Alternatively, you could put it all in different files, depending on the texture needed. The bottom line is that you somehow need a way to store the texture information with the geometry, so that you can match them up later as you draw.

This will, however, drastically change your loading. It's probably worthwhile to move on to a more capable format, which is a completely different discussion.
Yeah that seems like a lot a work for all of my options, especially for my purposes (school independent study), and all i think that all i really need to do is finish off a few parts, so i may just write them right in the glDrawScene() as just glbegin quads or triangles etc. Thanks everyone for all the help though!

This topic is closed to new replies.

Advertisement