Advertisement

Loading Multiple Textures

Started by July 09, 2003 10:59 PM
1 comment, last by MeeZ 21 years, 7 months ago
Hi there. I''m hoping that most people here are familiar with the NeHe OpenGL tutes. Anyway, Lesson 6 teaches you how to load a texture onto the sides of a cube. The following lesson then teaches you how to load a single bitmap and make 3 different textures from that. What I want to know is how do I load several bitmaps and make each one into a unique texture. Then how do I apply each texture to seperately drawn cubes, which are drawn using a drawCube() function I wrote, my problem with this is that I call that function between glPushMatrix() and glPopMatrix(). Where do I put the code to add the new texture to the new cube? I hope someone can help me out with this problem. Thanks for your help. Cheers. MeeZ
MeeZ
between teach quad draw just

glBindTexture(GL_TEXTURE_2D, g_Texture[textnum]);

where text num is the number of the texture you want.
Advertisement
I have a couple demos that do that - basically you have two choices - you can call glGenTextures once and pass it an array, or you can call it once per texture. Just keep track of the returned IDs because they''re how you switch between them, When you call glBindTexture with a certain ID, you''re basically setting that as the "active texture" and all texture functions act on the "current texture".

In my city demo I load the texture IDs as an array, in my modelling tool (which requires MFC) I load them one at a time.

Hope this helps.

Love means nothing to a tennis player

My nothing-to-write-home-about OpenGL webpage. (please pardon the popups!)

This topic is closed to new replies.

Advertisement