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 > 2d using 3d engine

#177606 - brave_orakio - Tue Sep 11, 2012 5:02 am

Hi guys. Basically I want to port over an existing GBA stuff that I made as a demo using the 3d engine so I want to know a few things about the 3d engine of the DS.

So to make something like a sprite, I bind a texture(the sprite image) to a quadrangle right? And if I want to create a tiled background, I use the same technique.

But as we know binding a texture to a quadrangle one by one is slow so the best way is to bind once and use a large texture and set the coordinates and size which a quad will use to make it run faster.

I think I got the basics down I think but do take note that I haven't done any actual coding for the above process (Some problem with my old laptop running the newer Devkitarm tools) hence my question, Can I use a different palette for each quad without having to bind the texture again?

Like say quads 1- 4 use the same image but different set coordinates and different palettes each? No need to give code (but it would be appreciated), I just want to know if its possible or else I discard my whole process and think of something knew. Thanks!
_________________
help me

#177607 - sverx - Tue Sep 11, 2012 9:14 am

I suggest you to give a look at relminator's "Easy GL2D DS", it may just fit your needs :)
_________________
libXM7 | NDS programming tutorial (Italiano) | Waimanu DS | A DS Homebrewer's Diary

#177608 - elhobbs - Tue Sep 11, 2012 11:24 am

As sverx suggested gl2d is a good place to start. To answer your question directly: yes, it is possible to change the palette independent of the texture. I am not sure that it has been established that switching textures on the ds is expensive though.

I am not sure that the videoGL library from libnds exposes this functionality or gl2d for that matter. Changing the texture and the palette are controlled by a single register for each.

#177610 - brave_orakio - Wed Sep 12, 2012 1:05 am

Ah I see. Thanks guys. Looks like my planned process will work after all.
Anyway, I just assumed about the texture switching cost since it is what I read in most non-ds 3d tutorials.
I just hope I can a new laptop soon for me to start on the porting process. My old one is at least 7 years old I think! A vintage IBM Thinkpad R31. Hahaha!

edit: If anybody is curious, the thing I said about switching texture to be costly, I read that from a 3d tutorial about iOS development using openGLES I think.
_________________
help me