#157622 - sUPREz - Tue May 27, 2008 10:24 am
Hi everyone. This is my first post. I'm new in DS dev.
I try to make a small game with a 3D ortho GUI.
I need to load several texture and I try to create a function that load a list of texture. Here is my code :
Everything works fine except the image8to16() function that make my ROM crash. I got "The rom-image has crashed" error message from no$GBA.
If I remove this line the program is running without problems but my textures are not loaded.
Can you give some help so I can't figure out where I'm wrong ? Thanks a lot.
EDIT : just a few word to say that I'm not using PA_lib.
I try to make a small game with a 3D ortho GUI.
I need to load several texture and I try to create a function that load a list of texture. Here is my code :
Code: |
typedef struct tagTEXTURE
{ char* name; GL_TEXTURE_SIZE_ENUM size_x, size_y; float x_reel, y_reel; } TEXTURE; const int numtexture = 3; TEXTURE* textures_list; void InitTextures() { textures_list = (TEXTURE*)malloc(numtexture*sizeof(TEXTURE)); textures_list[0].name = "Button00_pcx"; textures_list[0].size_x = TEXTURE_SIZE_128; textures_list[0].size_y = TEXTURE_SIZE_64; //.75 means that my texture only use 96px of the 128px textures_list[0].x_reel = 0.75; //.75 means that my texture only use 48px of the 64px textures_list[0].y_reel = 0.75; textures_list[1].name = "Button01_pcx"; textures_list[1].size_x = TEXTURE_SIZE_64; textures_list[1].size_y = TEXTURE_SIZE_64; textures_list[1].x_reel = 0.75; textures_list[1].y_reel = 0.75; textures_list[2].name = "Button02_pcx"; textures_list[2].size_x = TEXTURE_SIZE_64; textures_list[2].size_y = TEXTURE_SIZE_64; textures_list[2].x_reel = 0.75; textures_list[2].y_reel = 0.75; } int LoadGLTextures() // Load PCX files And Convert To Textures { InitTextures(); int i; sImage pcx; for(i=0;i<numtexture;i++) { loadPCX((u8*)textures_list[i].name, &pcx); image8to16(&pcx); glGenTextures(1, &texture[i]); glBindTexture(0, texture[i]); glTexImage2D(0, 0, GL_RGB, textures_list[i].size_x , textures_list[i].size_y, 0, TEXGEN_TEXCOORD, pcx.image.data8); imageDestroy(&pcx); } return TRUE; } |
Everything works fine except the image8to16() function that make my ROM crash. I got "The rom-image has crashed" error message from no$GBA.
If I remove this line the program is running without problems but my textures are not loaded.
Can you give some help so I can't figure out where I'm wrong ? Thanks a lot.
EDIT : just a few word to say that I'm not using PA_lib.