qwert
09-18-2001, 05:29 AM
Hi all,
I'm working with MFC and have got a dialog box: in the "OnInitDialog" I load my texture up like this:
glEnable(GL_TEXTURE_2D);
memset(TextureImage,0,sizeof(void *)*1);
if (TextureImage=LoadBMP("toltex.bmp"))
{
glGenTextures(1, &m_textureID);
glBindTexture(GL_TEXTURE_2D, m_textureID);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage->sizeX, TextureImage->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage->data);
}
In the "OnRender"-Function I set up the texture:
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE, GL_MODULATE);
glBindTexture(GL_TEXTURE_2D, m_textureID);
Of course, for the triangles I define the Texcoords... http://www.opengl.org/discussion_boards/ubb/smile.gif
So now, this way nothing happen. My object appears untextured. But if I put the first (and expensive) loading-code in the render-function, the texturing works... Any ideas?
qwert
I'm working with MFC and have got a dialog box: in the "OnInitDialog" I load my texture up like this:
glEnable(GL_TEXTURE_2D);
memset(TextureImage,0,sizeof(void *)*1);
if (TextureImage=LoadBMP("toltex.bmp"))
{
glGenTextures(1, &m_textureID);
glBindTexture(GL_TEXTURE_2D, m_textureID);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage->sizeX, TextureImage->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage->data);
}
In the "OnRender"-Function I set up the texture:
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE, GL_MODULATE);
glBindTexture(GL_TEXTURE_2D, m_textureID);
Of course, for the triangles I define the Texcoords... http://www.opengl.org/discussion_boards/ubb/smile.gif
So now, this way nothing happen. My object appears untextured. But if I put the first (and expensive) loading-code in the render-function, the texturing works... Any ideas?
qwert