i have got a single texture working in my opengl project the problem is it only lets me use one texture i was wondering how i can change this so i can use multiple textures maybe an array? when i load in more than one bitmap image i can't seem to get it to work
this is the code i am using to create the texture
glEnable (GL_TEXTURE_2D);
Bitmap image;
image.loadBMP ("TEXTURE1.bmp");
glGenTextures(1, &m_TextureID);
glBindTexture ( GL_TEXTURE_2D, m_TextureID);
glTexEnvf ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE , GL_MODULATE);
glTexParameterf ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
glTexParameterf ( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
gluBuild2DMipmaps ( GL_TEXTURE_2D, 3, image.width, image.height, GL_RGB, GL_UNSIGNED_BYTE, image.data);
glDisable (GL_TEXTURE_2D)
can anybody point me in the right direction thanks
Besides calling glGenTextures n times, you can do this :
const GLsizei n = 5;
GLuint textureIDs = new GLuint[ n ];
glGenTextures( n, textureIDs );
Try this if your stuck
GLuint num_textures = 5;
GLuint textures[num_textures];
glGenTextures(num_textures, textures);
:)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.