Welcome! Log In Create A New Profile

Advanced

JPEG Overlap & SD Card Reading

Posted by Legend28469 
JPEG Overlap & SD Card Reading
January 14, 2009 09:57PM
This is regarding my game ... Hate

Umm... First things first... How do I read off of the SD Card?

Secondly, How do you code JPEGS in a way that they would overlap with (umm.. i think it was called alpha-blending (from back in my C# days))

Thank you in Advance!!!
Re: JPEG Overlap & SD Card Reading
January 14, 2009 10:01PM
Reading off the SD card is done with libfat. You will want to add -lfat to your libs in your makefile and then #include at the top. Then you can just do fatInitDefault() in the beginning of your program and then use files like you normally would in C. Eg, to open a file for reading you would do FILE *file = fopen("sd:/path/to/file", "r"). Read up on C file I/O for more information, and check the libfat example in the examples directory of devkitpro.

As for the JPEG alpha blending, I can't help you there, but I don't think JPEGs have any alpha channel information. I assume you would mask out a certain color or something, but I haven't done anything with graphics on the Wii.
Re: JPEG Overlap & SD Card Reading
January 14, 2009 10:15PM
Thank you ... lol... I guess the game I'm making will be a little plain without alpha blending..
Re: JPEG Overlap & SD Card Reading
January 14, 2009 10:17PM
I'm sure you can do it, I just don't know how. But you could look in the list of GX functions or look at the source of other people's projects.
Re: JPEG Overlap & SD Card Reading
January 14, 2009 10:18PM
iofthestorm is correct, JPGs don't contain alpha info. Check out GRRLib. It uses PNGs (your image editor should be able to save those just as easily as JPGs) and lets you control the alpha of the entire image (if the alpha channel in the PNG isn't enough for you).
Re: JPEG Overlap & SD Card Reading
January 15, 2009 04:36AM
ok.. Thank you.. is the setup the same too... ??
Re: JPEG Overlap & SD Card Reading
January 15, 2009 02:00PM
Not exactly. The day 5 tutorial explains the process quite clearly though.
Re: JPEG Overlap & SD Card Reading
January 15, 2009 05:15PM
Alpha blending is a more powerful (and slower) version of masking. I think that you are more interested in masking. However, due to the hardware acceleration, you might as well do alpha blending since that is hardware accelerated.
Re: JPEG Overlap & SD Card Reading
January 15, 2009 06:18PM
Lol.. ok.. Thank you.. but umm.. any idea how to setup the GRRLIB files... Do they go in the PowerPPC part or the libogc... (sorry if its a noob question)
Re: JPEG Overlap & SD Card Reading
January 15, 2009 07:34PM
This is the blind leading the blind but here goes: download the GRRLib files and add them to your project's source directory. Open your Makefile and update the line that looks like:

SOURCES		:=	source

to:
SOURCES		:=	source source/GRRLIB

(This tells your Makefile to look inside the new GRRLib directory you just added.)

Then in the same Makefile update the line that looks (something) like:

LIBS	:= -lz -lwiiuse -lbte -logc -lm

to:

LIBS	:= -lpng -lz -lwiiuse -lbte -logc -lm

(This tells your Makefile to include libpng which is required by GRRLib.)

Then in main.c add:

#include "GRRLIB/GRRLIB.h"

Then follow the Day 5 tutorial.
Re: JPEG Overlap & SD Card Reading
January 15, 2009 07:39PM
Thank you for clearing that up...
Re: JPEG Overlap & SD Card Reading
January 15, 2009 08:21PM
ARG... :@.. its styll not working.. lol.. I hate to be a noob.. but i think i need a how to setup GRRLIB for dummies or something.... i've got a bunch of files.. but i'm not sure on where to put em.. my makefile is ok.. its just i don't know where to put the files that come with the whole package.. (sorry makefiles are new to me.. windows C++ programming was alot easier.. =D.. sorry... (wow.. i say sorry alot.. ) sorry)..
Re: JPEG Overlap & SD Card Reading
January 15, 2009 08:59PM
Put the .a file for grrlib in the /devkitPRO/libogc/lib folder. Put any .h files or folders containing .h files in the /devkitPRO/libogc/include folder. (This is assuming you're using the default install paths)
Re: JPEG Overlap & SD Card Reading
January 15, 2009 09:13PM
FINALLY.. thanks to all. that helped me... Back to crafting my game..........
Re: JPEG Overlap & SD Card Reading
January 16, 2009 08:17AM
Ew, having to compile libraries in your master makefile!
Re: JPEG Overlap & SD Card Reading
January 16, 2009 03:34PM
Quote
henke37
Ew, having to compile libraries in your master makefile!

Are you referring to my advice? I'm a total noob learning by example. What's the preferred way?
Re: JPEG Overlap & SD Card Reading
January 16, 2009 07:11PM
I think the preferred way would be to compile GRRLib once and then stick it in your /libogc/lib directory, and the .h in your libogc/includes directory.
Re: JPEG Overlap & SD Card Reading
January 17, 2009 02:27AM
Wouldn't I still have to include it in the Makefile with the list of other LIBS? If so, what's six in one hand versus half dozen in the other?
Re: JPEG Overlap & SD Card Reading
January 18, 2009 08:59AM
Quote
Sinman
Wouldn't I still have to include it in the Makefile with the list of other LIBS? If so, what's six in one hand versus half dozen in the other?

Err, you would include it in the makefile but you wouldn't have to compile it along with the rest of the stuff. But I'm pretty much a C noob so maybe henke37 can clarify. It just seems like bad programming practice to have your libraries in your source directory.



Edited 1 time(s). Last edit at 01/18/2009 08:59AM by iofthestorm.
Re: JPEG Overlap & SD Card Reading
January 18, 2009 11:35AM
Indeed, it is. You still need to include the header files, but you can skip the compilation and just go directly to the linking.
Sorry, only registered users may post in this forum.

Click here to login