gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > nglVideo - an alternative to videoGL

#174615 - DiscoStew - Wed Jun 30, 2010 9:44 pm

Some of you may remember me sending in a modified version of the videoGL.c file to the DevkitPro team for review, which included a few bug fixes and my own version of dynamic texture allocation. Well, my brain began spinning once again, and I tried my hand again at an alternative to the videoGL functionality.

What came about from this is the nglVideo library, a separate set of functions which contains most of the functions that videoGL contained, removing some here and adding some there. So, what does this library do that videoGL does not?

- Texture AND texture palette dynamic allocation
- Allocation based on current state of video banks (if a video bank is not allocated to textures or texture palettes, the allocator ignores that bank and moves to the next one)
- Textures can be deleted, so no need to always reset the entire system.
- ALL DS-native formats supported, including GL_COMPRESSED
- Textures not directly copied to video memory (except for GL_COMPRESSED), but stored in main memory where they await a function call to copy and remove from video memory

I would consider this an alpha version, because there are still a few things that need to be done, such as if vram banks are not in sequential order (like VRAM_B takes up slot0 and VRAM_A takes slot1).

I've supplied the library and an example below. The functions called, for the most part, have an 'n' appended to the start of the functions, to differentiate themselves from their videoGL counterparts. As for the rest of the gl-like functions found in video.h, they can be used in conjunction with nglVideo because they do not have any direct association with functions in videoGL.


Library
Example

The example project included is basically the Palette Cube example in libnds, but the functions are changed, and it also includes the compressed texture made by kusma (credit goes to him for that and his texture converter that generated the texture).

Note: When using GL_COMPRESSED textures, if the texture 'tiles' and 'header' are separate files, then they need to be combined together, the 'tiles' first, then the 'header', before using the call nglTexImage2D. Also, it is best to load the GL_COMPRESSED texture first unless you do manual video bank assigning to prevent the allocator from using certain banks when loading normal textures first, because if VRAM_B doesn't have enough space or if VRAM_A and VRAM_C don't have enough space, the compressed textures won't be loaded up.
_________________
DS - It's all about DiscoStew


Last edited by DiscoStew on Tue Jul 13, 2010 1:23 am; edited 1 time in total

#174624 - Gryphon93 - Fri Jul 02, 2010 11:00 am

This is interesting. I tested the example and I like the results. I may find use of this later on, but not right now. I didn't look through the source (because I'm to lazy to do so right now) but I compiled the example and it worked like a charm. Keep up the good work!