Iīm trying to write a textureclass/wrapper thing but I canīt get it to work with texture objects. Here is some code:
class CTextureObject {
GLubyte texels[64][64][3];
GLuint name;
void bind();
void fix();
CTextureObject();
};

void CTextureObject::CTextureObject()
{
glGenTextures(1, &name);
bind();
}

void CTextureObject::bind()
{
glBindTexture(GL_TEXTURE_2D, name);
}

void CTextureObject::fix()
{
bind();
setTextureParams();
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, size, size, 0, GL_RGB, GL_UNSIGNED_BYTE, texels);
}

My idea is to make/load a texture into texels[64][64][3] and then call fix(). Then when I need the texture I just call bind(). But this doesnīt work. When I do this itīs only the last texture fix(ed) that is binded. If I call fix() every time I need a texture all is fine.