Jump to content
  • Advertisement

Archived

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

Leroy1891

Texturing problem

This topic is 5550 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

I know that this question has been asked about 400 times but none of the other posts seem to help. I have a texture class that can load and bind a bitmap but it only works when it is global. when it is part of another class the textures load fine but don''t bind. Texturing is enabled and all BMP loading happens at the very end of the window creation code. //============================================================== void Textures::Bind() { glBindTexture(GL_TEXTURE_2D,TexName); } //============================================================== bool Textures::LoadFromBMP(char* Filename) { FILE *File; if(!Filename) return FALSE; File=fopen(Filename,"r"); if (File) { fclose(File); Data=auxDIBImageLoad(Filename); glGenTextures(1, &TexName); glBindTexture(GL_TEXTURE_2D, TexName); glTexParameteri (GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST); gluBuild2DMipmaps(GL_TEXTURE_2D,3,Data->sizeX,Data->sizeY, GL_RGB, GL_UNSIGNED_BYTE,Data->data); } else return FALSE; TexEmpty=FALSE; TexHeight=Data->sizeY; TexWidth=Data->sizeX; TexDepth=3; TexPixels=TexHeight*TexWidth; return TRUE; } //==============================================================

Share this post


Link to post
Share on other sites
Advertisement
no i''m not using display lists. One of the classes that it doesn''t work in uses vertex arrays but i''ve tested it in a class that has nothing but the info for the texture.

Share this post


Link to post
Share on other sites
Have you tried rendering the object without the texture? Sorry if it seems a bit too obvious...

Oh, and is the rendering context valid and selected?

[edited by - Ferdinand the Bull on March 16, 2003 12:28:45 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I have tried to render w/o the tex and it gives me the same white square. as for the rendering context, do i have to make it current beforehand since it''s in a class or does it stay valid once it is created?

Share this post


Link to post
Share on other sites
I have tried to render w/o the tex and it gives me the same white square. as for the rendering context, do i have to make it current beforehand since it''s in a class or does it stay valid once it is created?

Share this post


Link to post
Share on other sites
i have experienced a similar anomaly with accessing textures from external files. although i have a global id variable to track the texture id''s AND the file with the actual declaration of this variable contains codde to initialize the texture.

whenever i attempt to bind the textures from an external file (yes, i did declare extern for the id''s), the texture doesnt get applied. but attempting to bind the texture on the same source file seems to work.. any ideas?

it may be my error on some part, but will look into again later tonight

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!