Jump to content
  • Advertisement

Archived

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

Trosa_Henke

How to store texture names so they can be read?

This topic is 6022 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''m gonna let an object read the texture file names from a text file and store them in memory, the problem arises when auxDIBImageLoad reads the filename. I thought a pointer to an array of chars would do it but I was wrong. What should I store the names as since chars won''t do? glGenTextures will not have this code: int LoadGLTextures() // Load Bitmaps And Convert To Textures { int Status=FALSE; // Status Indicator char texture[10] = "Mud.bmp"; char *ptexture = texture; AUX_RGBImageRec *TextureImage[1]; // Create Storage Space For The Texture memset(TextureImage,0,sizeof(void *)*1); // Set The Pointer To NULL // Load The Bitmap, Check For Errors, If Bitmap''s Not Found Quit if (TextureImage[0]=LoadBMP(ptexture)) { Status=TRUE; // Set The Status To TRUE glGenTextures(1, &texture[0]); // Create Three Textures // Create MipMapped Texture glBindTexture(GL_TEXTURE_2D, texture[0]); Neither have I been able to find any documentation on the auxDIBImageLoad function.

Share this post


Link to post
Share on other sites
Advertisement
The function auxDIBImageLoad handles a chars just fine. One problem you have seems to be your call to glGenTextures(1, &texture[0]);. You defined texture as char texture[10] where texture should be GLuint texture[10]. If you defined it twice that could cause a problem. For loading an image, doing something like this should work fine:

GLuint texture[3];
int LoadGLTextures() // Load Bitmaps And Convert To Textures
{
int Status=FALSE; // Status Indicator
char *texname;
char ptexture[40];
texname="mud.bmp";
sprintf(ptexture,texname);
AUX_RGBImageRec *TextureImage[1];
memset(TextureImage,0,sizeof(void *)*1);
if (TextureImage[0]=LoadBMP(ptexture))
{
Status=TRUE; // Set The Status To TRUE
glGenTextures(1, &texture[0]); // Create Three Textures
// Create MipMapped Texture
glBindTexture(GL_TEXTURE_2D, texture[0]);
}

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!