Advertisement

OO texture failure

Started by December 09, 2002 05:51 PM
-1 comments, last by CodeMaster000 22 years, 2 months ago
I am pretty new to programming and I am trying to make a texture class. I finally worked out all the kinks till I get to one function actually loading the text. I think the problem has something to do with memory because I think I had the same problem when I would add a texture to Nehe''s base code and I would forget to add 1 to a curtain spot. Well basically I keep getting a "Multipong had cause an error in Multipong.exe" message. In Ctexture.h I declared these variables as member data of Ctexture: GLuint texture; AUX_RGBImageRec *TextureImage; here is the troubled function: ////////////////////////////////////////////////////////////////////// // Load Texture ////////////////////////////////////////////////////////////////////// void Ctexture::loadTexture() { memset(TextureImage,0,sizeof(void *)*1); // Set The Pointer To NULL if ( TextureImage=LoadBMP("images/Ball.bmp") ) { glGenTextures(1, &texture); // Create The Texture // Build This Texture glBindTexture(GL_TEXTURE_2D, texture); 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, TextureImage->sizeX, TextureImage->sizeY, GL_RGB, GL_UNSIGNED_BYTE, TextureImage->data); } if (TextureImage) // If Texture Exists { if (TextureImage->data) // If Texture Image Exists { free(TextureImage->data); // Free The Texture Image Memory } free(TextureImage); // Free The Image Structure } } Hopefully someone can understand my poor wording of this problem and help me. Oh ya! How do you make those nice scroll boxes for code. That could help me to make my posts more understandable.

This topic is closed to new replies.

Advertisement