• Advertisement

Archived

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

How to store texture names so they can be read?

This topic is 5850 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
dont use aux!
also
use strcpy( name, filename );

http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites
What should I use instead of aux then that can make use of strings? Can you give me an alternate code to the one I have posted?

Share this post


Link to post
Share on other sites
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
Thank you. I honestly apologize for bothering you people with rookie errors like this, it''s got nothing to with anything but slopyness.

Share this post


Link to post
Share on other sites

  • Advertisement