Archived

This topic is now archived and is closed to further replies.

Smokey97

Texture Problems

Recommended Posts

Hey, i seem to be having a weird problem with OpenGL inside SDL. I load the texture and create mipmaps and what not, now here''s the problem: I enable GL_TEXTURE_2D, i bind the texture, and map a quad (for example). Now everyhting should work (and it does if i do the exact same thing in Win32 API), BUT it doesent, it just shows a white quad... I also cannot see fnots if i try to use them in SDL. I know it''s an SDL pproblem because i have tryed the exact same code with Win32 API and it works fine... Any ideas on what is happening? or better yet, how i could fix it?

Share this post


Link to post
Share on other sites
i knocked up a qick test program....

http://bansheeforcestudios.digitalexplosions.com/test.cpp

This is driving me crazy, there is no reason why it shouldnt show these textures, but it doesent...

This totaly has me stumped.

Share this post


Link to post
Share on other sites
I saw one fairly big problem, textureType was being set to 6204 or something because apparently GL_RGB wasent defined, but i fixed that, BUT it still doesent work...

Do you know what the problem actualy is?
If so, PLEASE tell me.

Thnx heaps.

Share this post


Link to post
Share on other sites
Did you run the code through a debugger as I told you to do?

Take this switch-statement as an example. It's the second of the three in Texture::LoadTexture. This one illustrates the problem best but all three have the same problem.

    
switch(TT) {
case TGA_Type:
textureType = GL_RGB;
if(pImage->channels == 4) textureType = GL_RGBA;

gluBuild2DMipmaps(GL_TEXTURE_2D, pImage->channels, pImage->sizeX, pImage->sizeY, textureType, GL_UNSIGNED_BYTE, pImage->data);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);
break;

case BMP_Type:
//

break;
}

What is the value of TT? Is it really TGA_Type, which is the only value that will create the texture?

EDIT: Here's a hint. This is where you call Texture::LoadTexture.

  
texture.LoadTexture("face.bmp", "TEST", BMP_Type);
^
|
|


[edited by - Brother Bob on May 3, 2003 11:10:35 PM]

Share this post


Link to post
Share on other sites
Ya, that was a type, it should be something like texture.LoadTexture("Image.tga", "TEST", TGA_Type);


but guys, dont worry thnx heaps for helping.

My problem was a mix of loading the texture when there was no rendering context (like the first person said...) and i was initializing SDL incorrectly.

Once again, thank you for all your help.

Share this post


Link to post
Share on other sites