Page 1 of 1

Alpha Blending (Layers or Sprites)

Posted: Tue Jul 05, 2011 8:54 pm
by Tenry
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"?

Re: Alpha Blending (Layers or Sprites)

Posted: Wed Jul 06, 2011 3:13 am
by relminator

Re: Alpha Blending (Layers or Sprites)

Posted: Wed Jul 06, 2011 4:11 am
by zeromus
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

Re: Alpha Blending (Layers or Sprites)

Posted: Wed Jul 06, 2011 8:02 am
by Discostew
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.

Re: Alpha Blending (Layers or Sprites)

Posted: Wed Jul 06, 2011 12:48 pm
by Tenry
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.

Re: Alpha Blending (Layers or Sprites)

Posted: Wed Jul 06, 2011 5:31 pm
by Tenry
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.