Jump to content
  • Advertisement

Archived

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

Smokey97

Texture Problems

This topic is 5589 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
PLEASE GUYS, i need help; I have been trying to solve this problem for over 2 weeks now, ..and i cannot waste anymore time.

Share this post


Link to post
Share on other sites
Don''t be so fast to blame SDL. Just because the code works under Win32 doesn''t mean SDL is broken. Do you have a rendering context at the time you create your texture?

Share this post


Link to post
Share on other sites
No, i didnt.

But i tryed loading the texture once i had a rendering context, and it made no difference, still just a white quad.

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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!