
Problem loading textures with new code.
Hi to everyone.
I don't know what happens i'n the code, it compiles well under vc++7, when i execute the program it freezes, but the old code works fine?.
I'm using nehe's code. Loading 2 Textures
//********************** START ****************//
int LoadGLTextures()
{
int Status=FALSE;
GLuint loop;
AUX_RGBImageRec *TextureImage[2];
memset(TextureImage,0,sizeof(void *)*2);
if ((TextureImage[0]=LoadBMP("Data/Mud.bmp")) &&
(TextureImage[1]=LoadBMP("Data/Wood2.bmp")))
{
Status=TRUE;
glGenTextures(2, &texture[0]);
for (loop=0; loop<2; loop++)
{
glBindTexture(GL_TEXTURE_2D, texture[loop]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[loop]->sizeX, TextureImage[loop]->sizeY,
0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[loop]->data);
}
}
for (loop=0; loop<5; loop++) {
if (TextureImage[loop])
{
if (TextureImage[loop]->data)
{
free(TextureImage[loop]->data);
}
free(TextureImage[loop]);
}
}
OK");
return Status;
}
//***********************END***************//
Thank you to read this post if you can answer it better.
[edited by - eduardor2k on October 31, 2003 5:49:00 PM]

Thank you for reading this post, but if you can answer it better. :)
well, for 1, your for loop should be like this:
for(loop=0;loop<1;loop++)
for(loop=0;loop<1;loop++)
----------------------------------------------------"Plant a tree. Remove a Bush" -A bumper sticker I saw.
Thanks "tHiSiSbOb" i''t works fine now, i don''t know how i could missed that.
Thanks Again.
Thanks Again.
Thank you for reading this post, but if you can answer it better. :)
no problem.
----------------------------------------------------"Plant a tree. Remove a Bush" -A bumper sticker I saw.
Um as far as I understand it should be loop<2, because he has two textures... If you do loop<1 then it''ll only loop once...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement