#154901 - krozen - Tue Apr 22, 2008 5:32 pm
Hi guys,
I've just begun messing around with 3D on the DS. I am using the libnds examples as a guide. I just have a query regarding the glGenTextures function. In a libnds example, 10 seperate textures are generated using glGenTextures. My question is threefold (all relating to glGenTextures):
1. What textured data is "generated" using the glGenTextures function?
2. Where is the data generated by glGenTextures stored?
3. What are the limits on the number of texture slots available to be generated by glGenTextures?
Thanks for your help!
#154903 - M3d10n - Tue Apr 22, 2008 6:04 pm
You can download the libnds source code at its sourceforge page to see how the texture system works on inside. But here's some quickies:
krozen wrote: |
1. What textured data is "generated" using the glGenTextures function? |
It "generates" an integer in an array (actually, it increments the index of the next texture slot by the amount you specify).
krozen wrote: |
2. Where is the data generated by glGenTextures stored? |
In a static array. The data is simply the texture information, packed in an integer, as used by the DS to be feed into TEXIMAGE_PARAM (check GBATek on that one). The texture pixels are copied to the appropriated VRAM address.
krozen wrote: |
3. What are the limits on the number of texture slots available to be generated by glGenTextures? |
2048. This is set as a #define in the libnds source.
#154909 - krozen - Tue Apr 22, 2008 8:55 pm
Thanks M3d10n. Just reading through the source now. Didn't realise it was a full texture manager. Thought it just provided some defines over hardware registers.
Cheers anyway!
#154913 - TwentySeven - Tue Apr 22, 2008 10:16 pm
It's not a full texture manager. Specifically; you won't be able to delete or upload over individual existing textures using the library as is.
(Although I'm sure there will be improvements to that eventually ::NUDGE NUDGE NUDGE::)
So, until you modify things yourself (theres examples on these forums!), your usage pattern is pretty much going to be, upload all your textures, and if you need to change anything, delete them all and start over.
#154969 - krozen - Wed Apr 23, 2008 11:36 am
Yeah, I figured that the more I looked at it. It's a good reference point anyway. Thanks for your help guys!