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.

Beginners > Blending/Fading

#14022 - dagamer34 - Sat Dec 27, 2003 6:21 pm

Let me just get straight to the point...

Where to start? Source? Examples? etc...

Thanks
_________________
Little kids and Playstation 2's don't mix. :(

#14034 - poslundc - Sun Dec 28, 2003 12:06 am

The Cowbite Spec describes exactly how the registers work. It's pretty straightforward: you specify which elements (backgrounds, sprites, etc.) you want to be the source of the blend, which you want to be in the target, then specify an amount.

You can only blend one set of screen elements against another set of screen elements. Fading to black or white just involves using a different register to specify the amount and you only need to specify the source (since the target will either be the colour black or white).

You can also do fading using palette manipulation. This is simply a matter of interpolating the palette's members from their start value to their end value.

I'm think the standard tutorials (http://www.thepernproject.com, http://www.gbajunkie.co.uk) also cover this topic. They may have demo code you can download.

Dan.

#14037 - dagamer34 - Sun Dec 28, 2003 12:42 am

I have already looked at both www.pernproject.com and www.gbajunki.co.uk/

The Pern Project talks about it BRIEFLY but with no example for me to look at, i am between a rock and another rock with no where to go.

And looking at the CowBite spec does shed some light. I mean, i know what to do, alpha-blending just doesn't want to work for me. Basically, i would like an example/demo, using it.
_________________
Little kids and Playstation 2's don't mix. :(

#14038 - poslundc - Sun Dec 28, 2003 1:36 am

http://thepernproject.com/Examples/tutoralpha.zip

It took me about 30 seconds to find it on the Examples page. Did you even look?

Dan.

#14057 - jma - Sun Dec 28, 2003 5:31 pm

In Dragon BASIC there are the API functions FADEIN and FADEOUT. You probably are interested in C, that's fine. Go to http://www.jm-basic.com/dragon/download.php and get the Special Effects library.

Take a look at "EFFECTS.F" and it will give the assembly code for these functions, which isn't very difficult to follow (assuming you know ARM assembly).

If that isn't descriptive enough, I can try and post equivelant C code for you.

Jeff
_________________
massung@gmail.com
http://www.retrobyte.org

#14075 - dagamer34 - Mon Dec 29, 2003 1:42 am

Okay, i got it to work. Now my library is just about finished. I think maybe I'll post a link up here so newbies won't have to go through what I did.

Next up, windows. Besides CowBite, anybody know where i can get some info on them? And what can they be used for?
_________________
Little kids and Playstation 2's don't mix. :(

#14085 - jenswa - Mon Dec 29, 2003 2:24 pm

GBATEK is just another list as Cowbite for the gba.

There was an example of windows posted a few days ago on gbadev,
or was it fixed with scanlines? I can't remember exactly.
_________________
It seems this wasn't lost after all.

#14091 - dagamer34 - Mon Dec 29, 2003 7:08 pm

I think i am better off solving my own problems... Seems its always one thing that makes things go wrong.

But my LAST problem is not a syntax error. I need to know how to link in the standard C library. I am using the GBA Appwizard makefile so if you could just give me some directions, it would help make my day.

When this is all done, i think I'll make a tutorial over all this stuff, especially windowing and alpha-blending, the things not clearly said in the Pern Project or GBAJunkie tutorials.
_________________
Little kids and Playstation 2's don't mix. :(

#14100 - sajiimori - Mon Dec 29, 2003 8:59 pm

Quote:

When this is all done, i think I'll make a tutorial over all this stuff...

Would you consider posting it here for feedback first? As you've probably discovered, many of the tutorials out there have serious errors, and I'm sure you wouldn't want to inadvertantly cause confusion due to a typo somewhere. =)

Anyway, if you want to know how to link things, you can read the manual, or listen to what tepples and I have already said. If it isn't working with your makefile, try a different one, or try linking something by hand to see if you're getting the basic idea (recommended).

#14101 - jenswa - Mon Dec 29, 2003 9:17 pm

Or just use batch file, like i always do.

Well i don't get into interrupts and other difficult stuff,
because i can't set them up properly.

If it doesn't run with my make.bat i don't run it at all.
_________________
It seems this wasn't lost after all.

#14102 - dagamer34 - Mon Dec 29, 2003 9:47 pm

Tried the batch file, jenswa and i get the SAME errors. By the way, i am using v4 of DevKitAdvance. Is v5 beta 3 stable?

EDIT: I download v5-beta3 and it still doesn't work.

Here is my makefile:

Code:


# ------------------------------------------
# Title:      Default Makefile for use in VC++
# File:          GBALibTest.mak
# Revision:     01/06/2002
#
# Author:      Benjamin D. Hale
# Orignally by:         Jaap Suter
# Contributed to by:    Christer Andersson
#
# Info:              This file is contains the make-instructions
#         for the project. Replace DEVDIR with the appropriate
#                       base directory for devkitadv. After you make the
#                       needed modifications here rename this file to
#                       <project_name>.mak so Visual C++ does not get
#                       confused.
# -------------------------------------------

# -------------------------------------------
# Project name definition makes this whole thing
# a lot easier to use. Only two total modifications
# (other than what .o files will be needed)
# should be needed to get this working with your
# compiler and Visual C++. Replace "Default" with
# your project's name.
# -------------------------------------------

PROJECT = GBALibTest

# -------------------------------------------
# Define some directories;
# -------------------------------------------

# -------------------------------------------
# Base Directory for gcc arm-agb-elf replace with
# wherever you put your gba devkitadv files.
# -------------------------------------------

DEVDIR  = C:\Consoles\GBA\DevKits\DevKitAdv\v5

# -------------------------------------------
# Source directory (where your project's source files are located.)
# -------------------------------------------

SRCDIR  = C:\Consoles\GBA\Projects\DevKitAdv\GBALibTest\

# -------------------------------------------
# Compiler Directories for binaries, includes and libs.
# -------------------------------------------

CMPDIR  = $(DEVDIR)\bin
LIBDIR  = $(DEVDIR)\lib\gcc-lib\arm-agb-elf\3.0.2\interwork
LIBDIR2 = $(DEVDIR)\arm-agb-elf\lib\interwork
INCDIR  = $(DEVDIR)\lib\gcc-lib\arm-agb-elf\3.0.2\include
INCDIR2 = $(DEVDIR)\arm-agb-elf\include

# -------------------------------------------
# END of directory defines
# -------------------------------------------

# -------------------------------------------
# Define what extensions we use;
# -------------------------------------------
.SUFFIXES : .cpp .c .s

# -------------------------------------------
# Define the flags for the compilers;
# -------------------------------------------
CFLAGS  = -I $(INCDIR2) -I $(INCDIR) -I $(SRCDIR) -mthumb-interwork -c -g -O2 -Wall -fverbose-asm
SFLAGS  = -I $(INCDIR2) -I $(INCDIR) -mthumb-interwork
LDFLAGS = -L $(LIBDIR) -L $(LIBDIR2) -T LinkScript

# -------------------------------------------
# Define the list of all O files;
# Just follow the syntax shown to add any
# other objects your project may need to
# compile properly. You will need to add
# files to this part to make it work with
# your project add a \ to the end of all o
# files except the last one. Like below.
# -------------------------------------------

O_FILES          = \
                   crt0.o       \
                   crtbegin.o   \
                   crtend.o     \
               funct.o      \
               GBALibTest.o

# -------------------------------------------
# There should be no need to modify anything
# below here.
# -------------------------------------------

# -------------------------------------------
# Define the final dependecy;
# -------------------------------------------
all : $(PROJECT).gba

# -------------------------------------------
# Define the copy from .elf to .bin file
# -------------------------------------------
$(PROJECT).gba : $(PROJECT).elf
   $(CMPDIR)\objcopy -v -O binary $(PROJECT).elf $(PROJECT).gba
   -@echo ------------------------------------------
   -@echo Done
   -@echo ------------------------------------------
   
# -------------------------------------------
# Define the linker instruction;
# -------------------------------------------
$(PROJECT).elf : $(O_FILES)
   $(CMPDIR)\ld $(LDFLAGS) -o $(PROJECT).elf $(O_FILES) -lm -lc -lgcc -lstdc++
   -@echo ------------------------------------------
   -@echo Linking Done
   -@echo ------------------------------------------

# -------------------------------------------
# Define each compile;
# -------------------------------------------
{$(SRCDIR)}.cpp.o::
   $(CMPDIR)\gcc  $(CFLAGS) $<
   -@echo ------------------------------------------
   -@echo CPP-Sources Compiled
   -@echo ------------------------------------------

{$(SRCDIR)}.c.o::
   $(CMPDIR)\gcc  $(CFLAGS) $<
   -@echo ------------------------------------------
   -@echo C-sources Compiled
   -@echo ------------------------------------------

# -------------------------------------------
# Define each assemble;
# -------------------------------------------
{$(SRCDIR)}.s.o:
   $(CMPDIR)\as $(SFLAGS) $(SRCDIR)\$*.s -o$@
   -@echo ------------------------------------------
   -@echo ASM-Sources Compiled
   -@echo ------------------------------------------
   
# -------------------------------------------
# Any problems with getting this working email
# questions to whatzdat_pimp@hotmail.com .
# This was tested on devkitadv r4 and Visual C++ 6
# on a p3 450/512mb/Windows XP Pro.
# -------------------------------------------
# EOF;



I just don't get it. I am about to pull out my hair!!
_________________
Little kids and Playstation 2's don't mix. :(

#14104 - crossraleigh - Tue Dec 30, 2003 12:40 am

That makefile is fancy (or at least bloated), but its no way to learn. Here is a simpler one:
Code:
TARGET = foo
OBJ    = foo.o bar.o
LIB    = -L/path/to/library/files -lfoolib -Tlnkscript
CFLAGS = -I. -I/path/to/include/files -g -mthumb-interwork
CC     = /path/to/arm-agb-gcc

$(TARGET): $(OBJ)
   $(CC) -o $(TARGET).elf $(OBJ) $(LIB) # Make will compile each object individually then link them with LIB.
   /path/to/arm-agb-objcopy -v -O binary $(TARGET).elf $(TARGET).gba

clean:
   rm -f $(TARGET) (OBJ) # Use the DEL command if you are on DOS.

Make will exand that into something like:
Code:
/path/to/arm-agb-gcc -I. -I/path/to/include/files -g -mthumb-interwork -c foo.o foo.c
/path/to/arm-agb-gcc -I. -I/path/to/include/files -g -mthumb-interwork -c bar.o bar.c
/path/to/arm-agb-gcc -o foo.elf foo.o bar.o -L/path/to/library/files -lfoolib -Tlnkscript
/path/to/arm-agb-objcopy -v -O binary foo.elf foo.gba

There is no need to remake crt0.S each time, you could just prepend crt0.o (or any other other crt* files) to LIB. To link with a library (e.g., foolib.a) put -lfoolib in LIB.

#14106 - dagamer34 - Tue Dec 30, 2003 1:52 am

Since I don't think I am going to find that problem, i have decided to upload my project for those who feel like helping me and fixing it.

There's a readme for the project too. Thanks for all your help you guys.

And, yea, before I "officially" release the tutorials I'm making, I'll have someone proofread them for errors.

The site:
http://www.geocities.com/dagamer34/index.html
Its the first link.

This is a cheap site i put together in about 3 minutes, so don't critisize me!
_________________
Little kids and Playstation 2's don't mix. :(

#14117 - dagamer34 - Tue Dec 30, 2003 4:32 pm

I fixed my OWN problem. Unfortunately, there is yet another bug in DKA v5beta3(then again, it IS a beta).

In my project i got it to work with v4 and these link options: -lstdc++ -lm -lgcc -lc -lgcc

Any word on when v5 will be released?
_________________
Little kids and Playstation 2's don't mix. :(