You are not logged in.

#1 2009-04-27 12:19:23

Jonesy
Member

[RESOLVED] Make clarity on "image data inclusions"

Hi...
(first of all, sorry for the english.. -.- )

Before start using images in my applications (a bunch of lines of code, at the moment), i want to make clarity in my mind...
I have understand just 2 methods to put the data of an image into a GRRLIB_texImg variable:

1 - Convert the image in a "data file" (H or H + C) with WiiBuilder, then include this "data file" and load the buffer with GRRLIB_LoadTexture.

2 - Save the image in the SD card, then load it with GRRLIB_LoadFileTextureFromFile.


...now: also when i programmed something for NDS (still using devkitPro), i read in forums and tutorials, the use of the "DATA" folder.
...it seems that... putting some file in this folder, it will be "auto-included" in somehow or other...
...How to Work this damned folder?!?

Thanks, boys.
You're what i call: "Gente con della maruga" (people with productive brain).

smile  -Jonesy (Leo)-

Offline

 

#2 2009-04-27 13:44:40

NoNameNo
Administrator

Re: [RESOLVED] Make clarity on "image data inclusions"

i am far from a Makefile expert, but i think you can have some directive in it to use the provided with devkitpro raw2c binary (that convert file to C array (that i personaly use to convert image)). perhaps someone will give you a sample Makefile to get it working ? i know that there is this kind of stuff in some libogc sample where all jpg are converted in .o

hope it helped a very little wink

Offline

 

#3 2009-04-27 17:09:37

Crayon
Bad Mother Fucker

Re: [RESOLVED] Make clarity on "image data inclusions"

Modify this code in the Makefile to use the type of file you need:

Code:

#---------------------------------------------------------------------------------
# This rule links in binary data with the .png extension
#---------------------------------------------------------------------------------
%.png.o    :    %.png
#---------------------------------------------------------------------------------
    @echo $(notdir $<)
    $(bin2o)

After that, put the files in your data folder and compile.

The .h and .o files will be generated in the build folder. If your image was named my_image.png the header file will be my_image_png.h

So just included that file.

size is: my_image_png_size
data is: my_image_png[]

Offline

 

#4 2009-04-27 17:42:40

Jonesy
Member

Re: [RESOLVED] Make clarity on "image data inclusions"

Thank you for the quickness!

So.. if I understood, the "pre-conversion" of the image files... is not more necessary!
It's sufficient to put the original PNGs files in the DATA folder, and compile with the modified Makefile...!

I do a test and it works. Well ^_^!

But now, born a new question:
It's possible to do this "autogeneration" in the compiling phase, also for Audio files? (like .ogg)
It would be very useful.

Ciao -Jonesy Leo-

Offline

 

#5 2009-04-27 20:46:11

Crayon
Bad Mother Fucker

Re: [RESOLVED] Make clarity on "image data inclusions"

Jonesy wrote:

It's possible to do this "autogeneration" in the compiling phase, also for Audio files? (like .ogg)
It would be very useful.

It's possible to convert any kind of file to C code. For example, I use XML files in my project.

Offline

 

Board footer

Powered by FluxBB