You are not logged in.
As the entire texture is filled completely with 0x00's when created:
This:
// Initialize the texture for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { GRRLIB_SetPixelTotexImg(x, y, my_texture, 0x00000000); } }
can be replaced with this:
bzero(my_texture->data, (h *w) <<2);
Offline
That's a good idea. But to make it more standard I think I'll use memset instead of bzero:
memset(my_texture->data, '\0', (h * w) << 2);
Offline
*Just Asking* ...NOT criticising !
'\0' means "the character with an octal value of 0" (used to terminate strings)
0 means "the (octal) number 0"
Other than '\0' taking longer to compile they are otherwise identical
Why do you (and many others) use '\0' instead of 0 when dealing with numbers-not-strings?
Offline
'\0' means character zero. It's like '\32' means the space character.
I'm so lazy I did a copy/paste from a Web site talking about bzero:
The memset() function is preferred over this function.
For maximum portability, it is recommended to replace the function call to bzero() as follows:
#define bzero(b,len) (memset((b), '\0', (len)), (void) 0)
But your right they are exactly the same thing, and since my_texture->data is not a string maybe 0 would be less confusing.
Offline