Would the developers of libnds be interested in being able to have the library allow deleting of individual textures from VRAM, rather than having to reset it all and reload what didn't want to be deleted? For the past bit, I've been working on such a modification to the videoGL files in the libnds source, and while I have it working with current tests, it does need a bit of a speedup in allocation checking (pre-optimization is the devil, right?), and it may still be buggy. I wont go into details as to how it works, but what it will allow is the following...
glDeleteTextures - works the opposite as glGenTextures, deleting individual or a group of texture names, along with references to the texture, including VRAM position.
glGenTextures - You won't notice a difference from before, but it will work with what has been deleted with glDeleteTextures, should any texture names be deleted prior (rather than continually counting up for each new generated name, it will first check any that had been deleted before, and use them instead)
glTexImage2D - works exactly how it did before, but won't restrict the new texture to have similar parameters like the old texture (think of it like realloc, but for textures).
There are also a couple of new local functions inside libnds (much like getNewTextureSlot, which btw was removed), and while I don't remember an OpenGL-like function that kept a texture name but deleted the texture associated with it (like the opposite of glTexImage2D), perhaps it wouldn't be so bad to include one, much like glResetTextures is not part of OpenGL (to my knowledge).
If this is something people are interested in, then I'll try and fix any problems it may have, and possibly speed it up, then post it here.
glDeleteTextures, anyone? (libnds)
Re: glDeleteTextures, anyone? (libnds)
Not sure how many people have shown interest, but if you want proof, then here it is.
Download Link
NOTE: Be sure to back up existing files. If you are unsure about how to install these, then it is best not to try them out.
The compressed file contains the videoGL header and source code, as well as the compiled libnds library (1.4.3) that includes my modifications. Have a spin with it if you want. It retains all the original functions, but includes 2 new ones usable by the developer...
int glDeleteTextures( int n, int *names) - For deleting names, as well as any textures bound to them in VRAM.
int glClearTexture( void ) - Removes the texture currently bound from VRAM.
It also contains the fix I mentioned in the Bug Reports thread about textures of type GL_RGB copying twice the amount it needed to, as well as the change for if you bind a different-sized texture to a texture name that already has a texture in it.
Please let me know how this turns out for everyone, and any bugs or suggestions that turn up.
Download Link
NOTE: Be sure to back up existing files. If you are unsure about how to install these, then it is best not to try them out.
The compressed file contains the videoGL header and source code, as well as the compiled libnds library (1.4.3) that includes my modifications. Have a spin with it if you want. It retains all the original functions, but includes 2 new ones usable by the developer...
int glDeleteTextures( int n, int *names) - For deleting names, as well as any textures bound to them in VRAM.
int glClearTexture( void ) - Removes the texture currently bound from VRAM.
It also contains the fix I mentioned in the Bug Reports thread about textures of type GL_RGB copying twice the amount it needed to, as well as the change for if you bind a different-sized texture to a texture name that already has a texture in it.
Please let me know how this turns out for everyone, and any bugs or suggestions that turn up.
-
- Site Admin
- Posts: 1986
- Joined: Tue Aug 09, 2005 3:21 am
- Location: UK
- Contact:
Re: glDeleteTextures, anyone? (libnds)
Grab yourself a copy of libnds from svn, run a diff and attach it to the patch tracker at http://sourceforge.net/tracker/?group_i ... tid=668553
. It's much easier for us to look at and integrate your changes that way.
Something else that would help a lot is a small example illustrating how your code works.
. It's much easier for us to look at and integrate your changes that way.
Something else that would help a lot is a small example illustrating how your code works.
Re: glDeleteTextures, anyone? (libnds)
Alright, I'll go and do that.
Who is online
Users browsing this forum: No registered users and 1 guest