Page 1 of 2
How do you know when you run out of texture memory?
Posted: Mon Aug 08, 2011 5:22 am
by slenkar
When I run my game in the emulator it works but some of the textures look weird,
when I run it on the DS it just shows a blank screen,
Im converting a game from desktop to DS and the textures may take up more graphics memory than the DS has, is there a way of telling if that is the problem?
Re: How do you know when you run out of texture memory?
Posted: Mon Aug 08, 2011 6:31 am
by slenkar
Im using 3D quads to draw to the screen
so all my images are textures by the way
Re: How do you know when you run out of texture memory?
Posted: Mon Aug 08, 2011 6:47 am
by zeromus
1. you know how big your textures are
2. you know how much vram you allocated for textures
3. glTexImage2D has a return value
Re: How do you know when you run out of texture memory?
Posted: Mon Aug 08, 2011 2:25 pm
by elhobbs
emulators tend to be very forgiving in regards to exceptions that will hang the hardware. if you have not already, try running:
at the start of your main function. if an exception occurs at will dump registers and stack to a red screen which you can use to find the source of the problem.
Re: How do you know when you run out of texture memory?
Posted: Wed Aug 10, 2011 8:39 pm
by slenkar
'defaultExceptionHandler();'
thanks for the BROtip
Re: How do you know when you run out of texture memory?
Posted: Wed Aug 10, 2011 8:58 pm
by slenkar
when i put that in my main function it says:
error: expected constructor, destructor, or type conversion before ';' token
Re: How do you know when you run out of texture memory?
Posted: Wed Aug 10, 2011 9:14 pm
by elhobbs
slenkar wrote:when i put that in my main function it says:
error: expected constructor, destructor, or type conversion before ';' token
you need to add a header file either
#include <nds.h>
or minimally
#include <nds/arm9/exceptions.h>
Re: How do you know when you run out of texture memory?
Posted: Wed Aug 10, 2011 9:22 pm
by slenkar
ah yes I put it in the wrong place, it compiles now thanks
Re: How do you know when you run out of texture memory?
Posted: Wed Aug 10, 2011 9:30 pm
by slenkar
ok now if I run it in the emulator.. the emulator simply closes
If I run it on the hardware (original DS) it turns itself off!
Am I supposed to be calling the function every frame , or just once before the game loop?
Re: How do you know when you run out of texture memory?
Posted: Wed Aug 10, 2011 10:06 pm
by elhobbs
no, just call it once like I indicated. if you call "exit" then it will do this. add the following code to your project - systemErrorExit gets called before exit shuts down the DS. this example relies on stdout/printf being setup and wait for the A button to be pressed before shuting down.
Code: Select all
#ifdef __cplusplus
extern "C" {
#endif
void systemErrorExit(int rc) {
printf("exit with code %d\n",rc);
while(1) {
swiWaitForVBlank();
if (keysCurrent() & KEY_A) break;
}
}
#ifdef __cplusplus
};
#endif