I’m having difficulty accessing a texture object. When I choose a texture object that’s already been bound, the texture isn’t being activated and utilized by the texture mapping functions that follow.Here’s a sample of my code.
//initialization
//generate object IDs
GLuint textures[4]
glGenTextures(4,textures);
//Set properties of texture object
glBindTexture(GL_TEXTURE_2D,textures[0]);
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST );
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
gluBuild2DMipmaps( GL_TEXTURE_2D, 3,
m_pRGBImage->sizeX, m_pRGBImage->sizeY,
GL_RGB, GL_UNSIGNED_BYTE, m_pRGBImage->data );
If you’re wondering, m_pRGBImage is a pointer to the bitmap data. I know that’s not the problem because I can create mipmaps with this code. It’s the texture objects that don’t work.
Afterwards I tried to access this bitmap as follows.
//call texture object already bound
glBindTexture(GL_TEXTURE_2D,textures[0]);
I expected this code to work, but my functions for mapping textures to curves that followed didn’t use a texture. Can anyone tell me what I’m doing wrong?
thanks.