erwam.bancal
Still Fresh
- Joined
- Jun 7, 2007
- Messages
- 7
Hi I am new to gp2x development and yesterday I tried to make a rotate sprite routine.
I didn't work and at first I fought it just crashed. But after a while I worked out that it was just dreadfully slow.
So I made a test to see how slow it was, it looked like that :
CODE
unsigned tick1 = SDL_GetTicks ();
for (unsigned i=0; i<420; ++i)
{
for (unsigned j=0; j<280; ++j)
{
float result = 10.12564f * i + 11.256544f*j;
}
}
unsigned tick2 = SDL_GetTicks ();
fprintf(stderr, "It took %i milisecondes", tick2 - tick1);
And this took a little les that 5 seconds !
I am aware that the gp2x has no fpu so I made a test with integers.
CODE
unsigned tick1 = SDL_GetTicks ();
for (unsigned i=0; i<420; ++i)
{
for (unsigned j=0; j<280; ++j)
{
// for a rotate sprite function I need at least 10 integer mult and div :
// ten multiplication and division (integers)
...
..
.
}
}
unsigned tick2 = SDL_GetTicks ();
fprintf(stderr, "It took %i milisecondes", tick2 - tick1);
This took 300 milisec, I am aware that this is not optmised at all etc. But how are you supposed to make a decent 2d game with that power ? Is sprite rotation out of the question ?
Or is my unit bust ? I don't think so because I managed to run a 3d game demo.
All in all I am wondering : Is software sprite rotation possible ?
Thanks for your answers, I am really lost here.
PS: I am using the default gcc compiler optimisations.
--
Al'
I didn't work and at first I fought it just crashed. But after a while I worked out that it was just dreadfully slow.
So I made a test to see how slow it was, it looked like that :
CODE
unsigned tick1 = SDL_GetTicks ();
for (unsigned i=0; i<420; ++i)
{
for (unsigned j=0; j<280; ++j)
{
float result = 10.12564f * i + 11.256544f*j;
}
}
unsigned tick2 = SDL_GetTicks ();
fprintf(stderr, "It took %i milisecondes", tick2 - tick1);
And this took a little les that 5 seconds !
I am aware that the gp2x has no fpu so I made a test with integers.
CODE
unsigned tick1 = SDL_GetTicks ();
for (unsigned i=0; i<420; ++i)
{
for (unsigned j=0; j<280; ++j)
{
// for a rotate sprite function I need at least 10 integer mult and div :
// ten multiplication and division (integers)
...
..
.
}
}
unsigned tick2 = SDL_GetTicks ();
fprintf(stderr, "It took %i milisecondes", tick2 - tick1);
This took 300 milisec, I am aware that this is not optmised at all etc. But how are you supposed to make a decent 2d game with that power ? Is sprite rotation out of the question ?
Or is my unit bust ? I don't think so because I managed to run a 3d game demo.
All in all I am wondering : Is software sprite rotation possible ?
Thanks for your answers, I am really lost here.
PS: I am using the default gcc compiler optimisations.
--
Al'