View unanswered posts | View active topics It is currently Fri Nov 24, 2017 7:42 pm



Reply to topic  [ 57 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
 Easy GL2D 

Should libgl2d be integrated into libnds? viewtopic.php?p=6893#p6893
Yes, integrate it immediately if not sooner. 38%  38%  [ 35 ]
No, let's have this as a separate library and work towards middleware. 21%  21%  [ 19 ]
Let's do both - integrate it as is and build an abstraction layer on top. 16%  16%  [ 15 ]
I'm good with whatever is decided. 24%  24%  [ 22 ]
Total votes : 91

 Easy GL2D 
Author Message

Joined: Sun Apr 11, 2010 10:43 am
Posts: 82
Yo, Enay. I have just updated the lib. See if it fixes some of the issues you posted.

Better Docs too.

;*)


Fri Feb 18, 2011 3:24 am
Profile

Joined: Mon Aug 16, 2010 7:29 am
Posts: 15
Location: Japan
Thanks man. I will take a look now. :)


Fri Feb 18, 2011 3:46 am
Profile

Joined: Mon Aug 16, 2010 7:29 am
Posts: 15
Location: Japan
[snip]


Last edited by ENAY on Fri Feb 18, 2011 5:05 am, edited 1 time in total.



Fri Feb 18, 2011 4:23 am
Profile

Joined: Sun Mar 08, 2009 7:24 pm
Posts: 103
ENAY wrote:
Compiling the 'sprites' example gives me the error:-
Code:
gl2d.c:(.text+0x16da): undefined reference to 'glColorTableEXT'


I hope this helps. For now I will revert back to the previous version of your library.


Have you updated to the newest version of libnds?


Fri Feb 18, 2011 4:40 am
Profile

Joined: Mon Aug 16, 2010 7:29 am
Posts: 15
Location: Japan
Aaaah, no. That might explain everything ;)

[edit]Updated!

Looks like the GL2D library has changed a bit to do with pallettes so I need to modify my source code.

By the way Relminator I've also just reminded myself of something, in the features list you mention that this library supports 'alpha' but yet there are no parameters (as it seems) in your functions to enable to do so.

Keep up the good work :)


Fri Feb 18, 2011 4:41 am
Profile

Joined: Sun Apr 11, 2010 10:43 am
Posts: 82
ENAY wrote:
Aaaah, no. That might explain everything ;)

[edit]Updated!

Looks like the GL2D library has changed a bit to do with pallettes so I need to modify my source code.

By the way Relminator I've also just reminded myself of something, in the features list you mention that this library supports 'alpha' but yet there are no parameters (as it seems) in your functions to enable to do so.

Keep up the good work :)


Yeah, palettes are now bounded to the textures. Easier to use BTW.

Alpha support is via the textures you upload yourself. GL2D has nothing to do with it.


Fri Feb 18, 2011 8:40 am
Profile

Joined: Mon Aug 16, 2010 7:29 am
Posts: 15
Location: Japan
Well I am still having problems compiling. I get a lot of errors when it tries to create the .elf file.

Code:
linking jss-ds.elf
c:/devkitPro/libnds/lib\libgl2d.a(gl2d.o): In function `glScreen2D':
gl2d.c:(.text+0x1b2): undefined reference to `glInit_C'
gl2d.c:(.text+0x518): undefined reference to `glGlobalData'
gl2d.c:(.text+0x6a2): undefined reference to `glMaterialf'
gl2d.c:(.text+0x6aa): undefined reference to `glMaterialf'
gl2d.c:(.text+0x6b2): undefined reference to `glMaterialf'
gl2d.c:(.text+0x6ba): undefined reference to `glMaterialf'
c:/devkitPro/libnds/lib\libgl2d.a(gl2d.o): In function `glPutPixel':
gl2d.c:(.text+0x7c0): undefined reference to `glBindTexture'
c:/devkitPro/libnds/lib\libgl2d.a(gl2d.o): In function `glLine':
gl2d.c:(.text+0x81e): undefined reference to `glBindTexture'
c:/devkitPro/libnds/lib\libgl2d.a(gl2d.o): In function `glBox':
gl2d.c:(.text+0x896): undefined reference to `glBindTexture'
c:/devkitPro/libnds/lib\libgl2d.a(gl2d.o): In function `glBoxFilled':
gl2d.c:(.text+0x942): undefined reference to `glBindTexture'
c:/devkitPro/libnds/lib\libgl2d.a(gl2d.o): In function `glBoxFilledGradient':
gl2d.c:(.text+0x9ca): undefined reference to `glBindTexture'
c:/devkitPro/libnds/lib\libgl2d.a(gl2d.o):gl2d.c:(.text+0xa66): more undefined references to `glBindTexture' follow
c:/devkitPro/libnds/lib\libgl2d.a(gl2d.o): In function `glLoadSpriteSet':
gl2d.c:(.text+0x1600): undefined reference to `glGenTextures'
gl2d.c:(.text+0x1608): undefined reference to `glBindTexture'
gl2d.c:(.text+0x1624): undefined reference to `glTexImage2D'
gl2d.c:(.text+0x163a): undefined reference to `glColorTableEXT'
c:/devkitPro/libnds/lib\libgl2d.a(gl2d.o): In function `glLoadTileSet':
gl2d.c:(.text+0x16a0): undefined reference to `glGenTextures'
gl2d.c:(.text+0x16a8): undefined reference to `glBindTexture'
gl2d.c:(.text+0x16c4): undefined reference to `glTexImage2D'
gl2d.c:(.text+0x16da): undefined reference to `glColorTableEXT'
collect2: ld returned 1 exit status
make[1]: *** [/c/work/devkitpro-stuff/jss-ds/jss-ds.elf] Error 1
rm gfx.s
"make": *** [build] Error 2

> Process Exit Code: 2
> Time Taken: 00:19


Not sure where the problem lies, I noticed the source code in all of the examples has changed too so I have gone through every line of the source code and also compared the make files to see if anything else was changed. Perhaps I need to start a new project in devkitpro?




Ah yes, the Alpha support thing, I was getting confused between Alpha and Transparency. Indeed the command I was looking for was, for example:-

"glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE | POLY_ID(5));"

to have a percentage of drawing transparency.

Anyway, back to fault searching.


Fri Feb 18, 2011 9:40 am
Profile
Site Admin

Joined: Tue Aug 09, 2005 3:21 am
Posts: 1209
Location: UK
Looks like you're probably linking in the wrong order, libgl2d uses functions from libnds so it needs to be specified first in the LIBS line - i.e.
Code:
LIBS   :=   -lgl2d -lnds9


This brings up an interesting point though. As it stands now this library would probably serve users better if it was integrated into libnds rather than maintained separately. On the other hand I've already seen this working as a cross platform library on OSX, Windows and linux so it could potentially make for a nice piece of middleware if it were abstracted a bit more and included features for user input and audio output. The other way to go is to integrate this into libnds as it is now and build an abstraction layer on top of it later.

Anyone have any thoughts? I'll add a poll and a link to this post in the thread in a bit. I may go with the result of the vote or make an executive decision based on the general discussion.

_________________
Help keep devkitPro toolchains free, Donate today

devkitPro IRC support
Personal Blog


Fri Feb 18, 2011 1:14 pm
Profile ICQ WWW

Joined: Mon Aug 16, 2010 7:29 am
Posts: 15
Location: Japan
Thanks Wintermute, :D

That indeed worked, odd how before it worked with the parameters in reverse, I am using max mod library but that was always last. Anyway, thanks for that, it compiles ok now. It seems I always get beaten by the simplest of things.

Well, I think this library is really good. Although I've only been tinkering with the DS for a few weeks this library has really taken out a lot of low level programming and made things really easy to understand. I have had about 50 or so sprites rendering on both screens with backgrounds simultaneously without slowdown (slow in emulators though)
For 2D games I think this is ideal, you could easily make any kind of 2D game using this library on the DS.

If I had a suggestion, it would be that the library needs some sort of unload function, as currently there isn't really any way to know where your pointer is in memory. At some point I am probably going to want to swap around images in memory to transition to other graphics. Get rid of one image and replace it with another. Still not sure how I am going to do this but if there is a bit more automatic memory management (of course very difficult if you are using lots of different types of images) that would be great. To be safe I have simply made a 256x1024 image all tiled with everything I could possibly need. I have also opened up all the banks for memory.

Code:
// Set  Bank A to texture (128 kb)
   vramSetBankA( VRAM_A_TEXTURE );
   vramSetBankB( VRAM_B_TEXTURE );
   vramSetBankC( VRAM_C_TEXTURE );
   vramSetBankD( VRAM_D_TEXTURE );
   
   vramSetBankE(VRAM_E_TEX_PALETTE);


For now 512kb is more than enough for me. But yes, if there is a way to easily load images in and out of memory I would love to see that, even if it's just a limitation that you can only load in another image of the same type and colour depth that you first created, then I would be more than happy.

Not sure if this library needs more features for input or output. Better to leave it as a dedicated gfx library since loading sounds and detecting input is a lot simpler than loading and displaying graphics. Well that's just me anyway. But right now (aside from learning how to save and load files on a cartridge) I have pretty much everything I could possibly need.


Fri Feb 18, 2011 2:18 pm
Profile

Joined: Sun Apr 11, 2010 10:43 am
Posts: 82
Enay: LibNDS 1.5.0 can do dynamic textures.


Just glDeleteTexture() when you want to unload it. Then do a glLoad[Sprite/Tile]set() after that to load another texture.

Should work as long as you have enough VRAM allocated for textures.

BTW, pls. vote on the poll WM added.

edit: Could we have a look-see of your current game? ;*)


Fri Feb 18, 2011 2:45 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 57 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

Who is online

Users browsing this forum: No registered users and 1 guest


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

Search for:
Jump to:  
cron
  Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.
Get devkitPro at SourceForge.net. Fast, secure and Free Open Source software downloads