Homebrew [Release] {beta} sf2dlib - Simple and Fast 2D library (using the GPU)

tobiobito

Active Member
Newcomer
Joined
Jan 4, 2016
Messages
41
Trophies
0
Age
31
XP
80
Country
United States
Code:
git clone https://github.com/xerpi/sf2dlib.git
cd sf2dlib/libsf2d
make
make install

So I did that with libsf2d and it said installed but when I try this with libsftd I get this:

c:\devkitPro\libsftd>make
sftd.c
arm-none-eabi-gcc -MMD -MP -MF /c/devkitPro/libsftd/build/sftd.d -g -Wall -O2 -march=armv6k -mtune=mpcore -mfloat-abi=hard -I/c/devkitPro/libsftd/include -I/c/devkitPro/libctru/include -I/c/devkitPro/portlibs/armv6k/include -I/c/devkitPro/portlibs/3ds/include -I/c/devkitPro/portlibs/armv6k/include/freetype2 -I/c/devkitPro/portlibs/3ds/include/freetype2 -I/c/devkitPro/libsftd/build -DARM11 -D_3DS -c /c/devkitPro/libsftd/source/sftd.c -o sftd.o
c:/devkitPro/libsftd/source/sftd.c:6:22: fatal error: ft2build.h: No such file or directory
compilation terminated.
make[1]: *** [sftd.o] Error 1
make: *** [build] Error 2
 

VideahGams

Well-Known Member
Newcomer
Joined
Aug 29, 2015
Messages
91
Trophies
0
Age
26
Location
Glasgow, Scotland
Website
videah.xyz
XP
156
Country
So I did that with libsf2d and it said installed but when I try this with libsftd I get this:

c:\devkitPro\libsftd>make
sftd.c
arm-none-eabi-gcc -MMD -MP -MF /c/devkitPro/libsftd/build/sftd.d -g -Wall -O2 -march=armv6k -mtune=mpcore -mfloat-abi=hard -I/c/devkitPro/libsftd/include -I/c/devkitPro/libctru/include -I/c/devkitPro/portlibs/armv6k/include -I/c/devkitPro/portlibs/3ds/include -I/c/devkitPro/portlibs/armv6k/include/freetype2 -I/c/devkitPro/portlibs/3ds/include/freetype2 -I/c/devkitPro/libsftd/build -DARM11 -D_3DS -c /c/devkitPro/libsftd/source/sftd.c -o sftd.o
c:/devkitPro/libsftd/source/sftd.c:6:22: fatal error: ft2build.h: No such file or directory
compilation terminated.
make[1]: *** [sftd.o] Error 1
make: *** [build] Error 2

You need to install portlibs first.
 

VideahGams

Well-Known Member
Newcomer
Joined
Aug 29, 2015
Messages
91
Trophies
0
Age
26
Location
Glasgow, Scotland
Website
videah.xyz
XP
156
Country

tobiobito

Active Member
Newcomer
Joined
Jan 4, 2016
Messages
41
Trophies
0
Age
31
XP
80
Country
United States
If you are using cygwin, I don't think it comes with wget by default and you need to install the package yourself.
Thanks for the help btw. I am manually installing free type and I get this error:

checking dynamic linker characteristics... no
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... no
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking for i686-pc-mingw32-gcc... no
checking for gcc... no
checking for cc... no
configure: error: cannot find native C compiler
make[1]: *** [setup] Error 1
make[1]: Leaving directory `/c/devkitPro/3ds_portlibs-master/freetype-2.6.1'
make: *** [freetype] Error 2
 

Spaqin

Well-Known Member
Member
Joined
Feb 17, 2015
Messages
123
Trophies
0
Age
29
XP
199
Country
Poland
Hey,

I'm trying to compile my hb game on Linux. All the stuff at first goes fine (after two hours of removing small typos and fighting with the fact I dared to use more than one file for source), but then linker decides that it needs to go apeshit.

I installed sfil and sf2d libs, and yet I get multiple "undefined reference to 'sfil_load_PNG_file'", "undefined reference to `sf2d_draw_texture'" etc. errors.
Is this an error within the makefile (I just copied the one from 3DS ctrulib examples), or something more serious?
 

Slashcash

Well-Known Member
Member
Joined
Oct 15, 2015
Messages
338
Trophies
0
XP
611
Country
Italy
Hey,

I'm trying to compile my hb game on Linux. All the stuff at first goes fine (after two hours of removing small typos and fighting with the fact I dared to use more than one file for source), but then linker decides that it needs to go apeshit.

I installed sfil and sf2d libs, and yet I get multiple "undefined reference to 'sfil_load_PNG_file'", "undefined reference to `sf2d_draw_texture'" etc. errors.
Is this an error within the makefile (I just copied the one from 3DS ctrulib examples), or something more serious?

The problem here seems that your linker can't find the sf2d and sftd libraries. I suppose the fix should be between one of this option

1) Have you installed devkitpro in the default places? For linux it is usually /opt/devkitpro. If so, have you installed sf2d and sftd correctly? (a make && make install should do the job

2) Are you possibly using the makefile from the ctrulib's template? If so the error is explained. You should use the makefile from the example contained in the sf2d library (as the makefile from ctrulib doesn't link the sf2d library)
 
  • Like
Reactions: Spaqin

Spaqin

Well-Known Member
Member
Joined
Feb 17, 2015
Messages
123
Trophies
0
Age
29
XP
199
Country
Poland
2) Are you possibly using the makefile from the ctrulib's template? If so the error is explained. You should use the makefile from the example contained in the sf2d library (as the makefile from ctrulib doesn't link the sf2d library)
Yup, that was it! I used the one from sfil lib though, and now it compiles!
Oh well, now the worst part, testing.
 

MasterFeizz

Well-Known Member
Member
Joined
Oct 15, 2015
Messages
1,098
Trophies
1
Age
29
XP
3,710
Country
United States
Can someone point me towards loading a texture directly from a .png file instead of adding it as a binary?
You have to use libpng to get the pixelmap then pass that to sf2d_create_texture_mem_RGBA8. TGA is easier to load and you don't need a separate library, even easier you can also load RAW RGBA8 textures from a file.
 

Spaqin

Well-Known Member
Member
Joined
Feb 17, 2015
Messages
123
Trophies
0
Age
29
XP
199
Country
Poland
Inside sure, but it boils down to one function sfil_load_PNG_file() that returns a pointer to sf2d_texture, so if he doesn't want to play with bare libpng and sf2d_create_texture_mem_RGBA8(), I think it's much simpler.
 
  • Like
Reactions: cearp

Sono

cripple piss
Developer
Joined
Oct 16, 2015
Messages
2,829
Trophies
2
Location
home
XP
9,421
Country
Hungary
Hmm... I wonder using this is how many times faster than just regular framebuffer memcpy :P

Also, would it be possible to change the co-ordinate system? The renderer I wrote works from bottom-up, and not top-down, so {x=0,y=0} is the 0th physical pixel (bottom-left on the screen), and {x=0,y=1} is the first physical pixel (above the bottom-left pixel), {x=1,y=0} is the 240th pixel (to the right of the bottom-left pixel), and so on.
 

MasterFeizz

Well-Known Member
Member
Joined
Oct 15, 2015
Messages
1,098
Trophies
1
Age
29
XP
3,710
Country
United States
Hmm... I wonder using this is how many times faster than just regular framebuffer memcpy :P

Also, would it be possible to change the co-ordinate system? The renderer I wrote works from bottom-up, and not top-down, so {x=0,y=0} is the 0th physical pixel (bottom-left on the screen), and {x=0,y=1} is the first physical pixel (above the bottom-left pixel), {x=1,y=0} is the 240th pixel (to the right of the bottom-left pixel), and so on.
You simply have to modify the projection matrix, just switch the bottom and top values.
 

Sono

cripple piss
Developer
Joined
Oct 16, 2015
Messages
2,829
Trophies
2
Location
home
XP
9,421
Country
Hungary
You simply have to modify the projection matrix, just switch the bottom and top values.

The only problem with that is that I have <0% knowledge with the GPU and 3D (my programs are mostly console-based because of this), so I don't know what to edit :blush:
If you could, could you please point me in the right direction?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    BigOnYa @ BigOnYa: Yea my monitors are definitely more than 3.9 feet away from my pc tower. But not like I'm gonna...