How to store texture names so they can be read?
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.
dont use aux!
also
use strcpy( name, filename );
http://uk.geocities.com/sloppyturds/gotterdammerung.html
also
use strcpy( name, filename );
http://uk.geocities.com/sloppyturds/gotterdammerung.html
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?
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]);
}
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]);
}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement