#132197 - Rajveer - Sun Jun 24, 2007 3:37 pm
Hi guys. I'm currently rewriting a game of mine to use libfat, and I'm trying to load my original *.bin graphic files. What I'm doing so far:
This results in the quad not being textured. I'm not sure if I'm making proper use of glTexImage2D's last argument (pointer to the graphic), and this is the first time I've ever used any file I/O so can anybody show me where I'm going wrong?
Code: |
FILE *file_Pointer;
//Create Texture Space int main_Menu_Texture[1]; int main_Menu_Texture_Palette[1]; //Load Textures //Open first texture file, check if exists if(( file_Pointer = fopen("/Futuracer/Menus/Main Menu/Graphics/Graphic1.bin", "rb") ) == NULL) {printf("ERROR: Loading Graphic1.bin\n");} else{printf("Reading Graphic1.bin\n");} //Load file into texture space glGenTextures(1, &main_Menu_Texture[0]); glBindTexture(0, main_Menu_Texture[0]); glTexImage2D(0, 0, GL_RGB256, TEXTURE_SIZE_128 , TEXTURE_SIZE_128, 0, TEXGEN_TEXCOORD, (u8*)file_Pointer); glBindTexture(0, 0); //Close filestream fclose(file_Pointer); //Open first texture file palette, check if exists if(( file_Pointer = fopen("/Futuracer/Menus/Main Menu/Graphics/Graphic1_pal.bin", "rb") ) == NULL) {printf("ERROR: Loading Graphic1_pal.bin\n");} else{printf("Reading Graphic1_pal.bin\n");} //Load palette file into palette space main_Menu_Texture_Palette[0] = gluTexLoadPal((u16*)file_Pointer, 32, GL_RGB32_A3 ); //Close filestream fclose(file_Pointer); |
This results in the quad not being textured. I'm not sure if I'm making proper use of glTexImage2D's last argument (pointer to the graphic), and this is the first time I've ever used any file I/O so can anybody show me where I'm going wrong?