Alpha Blending (Layers or Sprites)

Post Reply
Shy Guy
Posts: 12
Joined: Tue Jun 01, 2010 11:02 am
Location: Germany

Alpha Blending (Layers or Sprites)

Post by Shy Guy » Tue Jul 05, 2011 8:54 pm

Does the Nintendo DS not provide a feature for blending layers? In some old tutorials I've read something about BLEND_CR and different blend defines, I might use, but in the current libnds documentation there's not even a word of blending (except for the ObjBlendMode, but it's nowhere explained).

Should I "redefine" those registers myself to use the feature, or what should I do?
Is that tutorial "false"?

relminator
Posts: 82
Joined: Sun Apr 11, 2010 10:43 am

Re: Alpha Blending (Layers or Sprites)

Post by relminator » Wed Jul 06, 2011 3:13 am


zeromus
Posts: 212
Joined: Wed Mar 31, 2010 6:05 pm

Re: Alpha Blending (Layers or Sprites)

Post by zeromus » Wed Jul 06, 2011 4:11 am

the libnds documentations arent the final word on the libnds features.
libnds features arent the final word on nds features.
libnds contains REG_BLDCNT, REG_BLDY, and REG_BLDALPHA. study the operations of these regs on gbatek

Discostew
Posts: 103
Joined: Sun Mar 08, 2009 7:24 pm

Re: Alpha Blending (Layers or Sprites)

Post by Discostew » Wed Jul 06, 2011 8:02 am

Looking at the sprite code in libnds, I see this...

Code: Select all

void oamSet(OamState* oam,	int id,  int x, int y, int priority,
 							int palette_alpha, SpriteSize size,SpriteColorFormat format,
 							const void* gfxOffset,
 							int affineIndex,
 							bool sizeDouble, bool hide, bool hflip, bool vflip, bool mosaic) {
.
.
.
if(format != SpriteColorFormat_Bmp) {
		oam->oamMemory[id].colorMode = format;
	} else {
        oam->oamMemory[id].blendMode = format;
		oam->oamMemory[id].colorMode = 0;
	}
.
.
.
Unless I'm mistaken, this is the only part of the source code that seems to alter "blendMode", for which it only ever gets set to "SpriteColorFormat_Bmp". Of the available enum values for "SpriteColorFormat", there are these 3...

Code: Select all

SpriteColorFormat_16Color = OBJCOLOR_16,/**< 16 colors per sprite*/
   SpriteColorFormat_256Color = OBJCOLOR_256,/**< 256 colors per sprite*/
   SpriteColorFormat_Bmp = OBJMODE_BITMAP/**< 16-bit sprites*/
Semi-Transparent and Windowing mode are absent.

Shy Guy
Posts: 12
Joined: Tue Jun 01, 2010 11:02 am
Location: Germany

Re: Alpha Blending (Layers or Sprites)

Post by Shy Guy » Wed Jul 06, 2011 12:48 pm

relminator wrote:Here's the "easy" way:

http://devkitpro.org/viewtopic.php?f=25&t=2333
Hm, I have to use an additional lib then? Have I to study new functions and such? I'd like to use features nothing to do with "GL", if possible ^^

zeromus wrote:the libnds documentations arent the final word on the libnds features.
libnds features arent the final word on nds features.
libnds contains REG_BLDCNT, REG_BLDY, and REG_BLDALPHA. study the operations of these regs on gbatek
Ah, thanks, that might be the registers helping me out. I've read in old tutorials about "BLEND_CR", but that isn't any longer in the new version, because registers now begin with "REG_".

I'll try out about these.

Shy Guy
Posts: 12
Joined: Tue Jun 01, 2010 11:02 am
Location: Germany

Re: Alpha Blending (Layers or Sprites)

Post by Shy Guy » Wed Jul 06, 2011 5:31 pm

zeromus wrote:the libnds documentations arent the final word on the libnds features.
libnds features arent the final word on nds features.
libnds contains REG_BLDCNT, REG_BLDY, and REG_BLDALPHA. study the operations of these regs on gbatek
Okay, thanks. I've tested different values, with the help of gbatek, and I quite got what I wanted.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest