Notice: * glColorTable() has been deprecated since the release of libnds 1.5.0. Because of the it, stencil effects are not possible w/o some hacks so I just disabled it altogether. However, rendering sprites in any palette is a lot easier now since palettes are automatically managed by libnds.

* You also need to tell libnds what VRAM bank you want allocate for texture palettes. See the example files.

1. Library size is very small (less than 10 kb)2. Very fast3. Easy to maintain and refactor existing code4. Abstracted interface5. Code is easily portable to other platforms6. Can combine 2D and 3D seamlessly7. Almost unlimited palette usage in a single frame8. Can handle non-power of 2 sprites9. 3 types of translucency (2 via textures and 1 via polygon format)10. Lots of sprite effects (colors, alpha, rotation, scaling, shearing, etc.)11. Optimum VRAM use12. Paletted(almost limitless) and high-color mode can be used together.

Limitations:

1. Emulators are slower in emulating the 3d hardware than the OAM.2. glPutPixel, glLine and glBox only works on a real DS and No$GBA and not on deSmuMe.3. You still have to learn how to use the sub OAM and sub BG since this lib is main engine only. You can use the video capture to render on both screens but that would limit your FPS and would use valuable VRAM.

Installation:

1 . Copy the distributable/libnds folder to your devkitPro directory. or you can copy the /include and /lib folders under the /libnds directory of devkitPro. ie. *Assuming you installed devkitPro in c:/devkitPro/

c:/devkitPro/libnds/include/gl2d.h c:/devkitPro/libnds/lib/libgl2d.a

2. Edit this line in your makefile and add gl2d before libnds ie. LIBS := -lnds9

to

LIBS := -lgl2d -lnds9

4. Add #include <gl2d.h> to your source.

5. Done! You can now use gl2d

Note:

Easy GL2D DS works perfectly on a Real DS.

However, if you are running this on an emulator...No$GBA - works perfectly.deSmuMe - use the soft rasterizer instead of OpenGL

* I'm in the process of writing a documentation as well as a user's guide that would essentially be a mini tutorial of sorts.

@WinterMute: You are free to add this to devkitPro if you deem it good enough. :*)

Last edited by relminator on Fri Feb 18, 2011 3:15 am, edited 2 times in total.

I'll do my best. I haven't done much with 3d engine so I may not know bugs when I see them. I going to try to get a couple layers of background and a character moving around. Also try to get the dual screens working.

While I was working on pixel art a while ago I spent some time seeing how much detail I could get with different sprite sizes while still keeping the figures proportional. My vague plan involved using really large sprites. I won't have room to store the amount of animation I want in vram all the time. I'll have to store it in main memory and probably on the flash card.

The plan is based on me actually being able to produce the art first. I'll have an idea of how big everything will be later.

I will and try and post this again as it seemed to get lost last time. I wish I had backed up my post last time

Ok, I have been trying to use this library for the past few days. It looks really great but unfortunately my images come out black. This also happens when I compile the GL2D tutorials as well, most of the images render black. I thought it might be my fault but I have been looking for ages at what could be wrong and found nothing. The example precompiled binaries for GL2D work on all DeSmuME.0.9.4-win32, no$gba-w.2.6a and the real DS but it is when I simply load up the project in programmers notepad and try to compile myself and make new binaries that there are problems. Problems occur on both emulators and a real DS.

So I was wondering whether maybe something new in libnds 1.4.9 has broken this library 2 months since it has been posted or something along those lines, sadly I can't download the old version of libnds to check for myself. The 'Sprites' example has the Anya picture displaying ok but all other sprites are black. The scrolling example with Chronos shows the pinky window only and everything else is black. I have tried uninstalling and reinstalling both GL2D and all of devkidpro and no changes. All other source codes and tutorials compile ok, just when I try to use the GL2D library I get problems. Well anyway I am totally stuck and was wondering whether anyone has the same problem or confirm that it's not just me going crazy.

I was using the libnds version I downloaded last December. The old lib puts all its palettes to Vram E.

I can't DL the new lbnds with my current connection speeds right now but the good news is that I'll be in the city in the next few days(where I have a better connection). I'll update the lib when I get there.

EDIT:

After talking with zeromus(he was the one who changed it), this should fix things:

// This imagesets would use our texture packer generated coords so it's kinda// safe and easy to use // ENEMIES_NUM_IMAGES is a value from "uvcoord_crono.h"// ZERO_NUM_IMAGES is a value from "uvcoord_zero.h"glImage Enemies[ENEMIES_NUM_IMAGES]; // spritesetglImage Zero[ZERO_NUM_IMAGES]; // spriteset

// These sprites are single texture only so no need to// do anything specialglImage Shuttle[1]; // single image glImage Anya[1];

int main() {

int i;

//set mode 5, enable BG0 and set it to 3D videoSetMode( MODE_5_3D );

consoleDemoInit();

// initialize gl2d glScreen2D();

// Set up enough texture memory for our textures // Bank A is just 128kb and we are using 194 kb of // sprites vramSetBankA( VRAM_A_TEXTURE ); vramSetBankB( VRAM_B_TEXTURE ); vramSetBankE(VRAM_E_TEX_PALETTE);

// Load our 256 color enemies palette // enemiesPal, enemiesPalLen are found in a GRIT generated header // Also save the return value for reference later since we // are using more than 1 palette. int EnemiesTexPal = gluTexLoadPal( enemiesPal, enemiesPalLen, GL_RGB256 );

You beat me too it! I finally tracked down an earlier build from around december and was just about to say that everything is working ok now that I compile in the older version. I have only been tinkering around with the DS for about a week so I don't really know where much is yet, but quite clearly if the texture banks have been updated in devkitpro then there lies the problem. Especially since I had a feeling it was to do with banks.

Please post here again when you have an update. I'd really appeciate it.For now at least I can actually see what I am doing. It's very difficult to code anything when everything is appearing black! Thanks for reading my post. Seeya.

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum