Welcome! Log In Create A New Profile Wiibrew Wiki HackMii Blog

Advanced

Textures and a few questions

Posted by TheCodingBrony 
Textures and a few questions
May 07, 2014 07:47AM
I want to know how to manually upload raw textures into vram as I'm planning to port a PlayStation homebrew game I made which has texture images embedded in its level files. I know I have to convert the texture data into an appropriate format using Metaphrasis but how do I upload the converted data into vram?

Also, I don't know if it is possible to unload/delete textures on vram as I can't find a function in the libogc docs that does this and I also want to know the maximum texture resolution the Wii can handle which I guess is 1024x1024.

I'm also not sure what will happen if I set my texture vertex format as GX_U16 but I'd like to know since calculating texture coordinates as floats can get very CPU intensive and that I want to address parts of the texture in pixel-perfect units.

I also want to know the endianess of the Wii as I've read that the PowerPC architecture is bi-endian but I don't have a clear idea of what type of endianess it is running on by default.


Any help will be greatly appreciated...
- TheCodingBrony
Re: Textures and a few questions
May 07, 2014 09:14AM
The Wii (and PowerPC in general) is big-endian.
Textures don't get "uploaded to vram", they live in either MEM1 or MEM2. I suggest you look at the gxSprites example (in devkitpro/examples/wii/graphics/gx/gxSprites) to see how to link textures at compile time and load them from static data at runtime.
Re: Textures and a few questions
May 07, 2014 08:43PM
I already know how to load textures off of TPL files (as demonstrated in the gxSprites example) but I want to know how to load non-tpl textures (bitmaps, raw RGB data, etc) which I couldn't find an example of.

...and now I know that texture data is stored in either MEM1 or MEM2, then what is this 3MB of embedded memory inside the GPU used for?
Re: Textures and a few questions
May 08, 2014 08:26PM
Re: Textures and a few questions
May 09, 2014 08:46AM
After browsing about GRRLIB's source code in the link you provided, I finally found exactly what I've been looking for.

Thanks owen!
Re: Textures and a few questions
May 09, 2014 01:06PM
The 3MB is divided into 2MB for the embedded frame buffer (where stuff gets drawn to) and 1MB texture cache (which the hardware uses however it wants, it is not accessible to programs).
Sorry, only registered users may post in this forum.

Click here to login