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

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy
I have problems cross compiling on win7 freetype2 lib, that is a prerequisite for libsf2d.

Could someone provide me the compiled package to be copied in the devkitpro/portlib/armv6k ?
 

TheCruel

Developer
Banned
Joined
Dec 6, 2013
Messages
1,350
Trophies
2
XP
3,131
Country
United States
I have problems cross compiling on win7 freetype2 lib, that is a prerequisite for libsf2d.

Could someone provide me the compiled package to be copied in the devkitpro/portlib/armv6k ?
Did you try compiling from xerpi's git repo? He had to add a flag to disable a feature, otherwise it doesn't compile.
 

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy
Solved. I found a set of .mk file for crosscompiling freetype2 for cortex from windows, and modified the files for the 3DS architecture.
 

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy
I'm going crazy,

I think to have fixed all my toolchain, installed from scratch latest vesion of devcitpro and python (3.4), and built again ctulib (latest version) and all the libs by xerpi (with the portlibs dependencies).

Now I don't have problems compiling anymore, but the drawing textures with sf2dlib has a strange behavior. The images flickers: the drawing stops before ending the texture and if there are other textures in the command buffer they are not processed.

The problem seems to be time related, the bigger the texture, the less the part drawn.

I tryed using a small texture (about 160*102, the screen of a lynx emulator ;) ), it's drawn only about half, but after a variable time (from 1 to 5 minutes) the situation get stable and then drawing bigger imeges works fine. This doesn't happen using bigger images.

If after the the drewing is stable I exit to HB Channel and restart the program, the problem starts again.

With a cia file it's the same.

I tested several codes exaple, the sf2dlib exaple compiled unchanged too. Attached the compiled 3dsx (used dummy red icon) if you want to give a look to this phenomenon.

It's very strange and I'm not able of fixing it by code.
 

Attachments

  • sf2d-sample.zip
    86 KB · Views: 123

marc00077

Well-Known Member
Member
Joined
May 21, 2014
Messages
125
Trophies
0
Location
Catalunya
XP
192
Country
Netherlands Antilles
I'm going crazy,

I think to have fixed all my toolchain, installed from scratch latest vesion of devcitpro and python (3.4), and built again ctulib (latest version) and all the libs by xerpi (with the portlibs dependencies).

Now I don't have problems compiling anymore, but the drawing textures with sf2dlib has a strange behavior. The images flickers: the drawing stops before ending the texture and if there are other textures in the command buffer they are not processed.

The problem seems to be time related, the bigger the texture, the less the part drawn.

I tryed using a small texture (about 160*102, the screen of a lynx emulator ;) ), it's drawn only about half, but after a variable time (from 1 to 5 minutes) the situation get stable and then drawing bigger imeges works fine. This doesn't happen using bigger images.

If after the the drewing is stable I exit to HB Channel and restart the program, the problem starts again.

With a cia file it's the same.

I tested several codes exaple, the sf2dlib exaple compiled unchanged too. Attached the compiled 3dsx (used dummy red icon) if you want to give a look to this phenomenon.

It's very strange and I'm not able of fixing it by code.

Lolwut? This is so strange, is works great on citra, but in 3ds does this weird thing. Did you get the source from xerpi's github?
 
Last edited by marc00077,

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy
Lolwut? This is so strange, is works great on citra, but in 3ds does this weird thing. Did you get the source from xerpi's github?

Yes. I posted the compiled version of this code to avoid doubt of some bug in the code, but I have this effect with every use od sf2dlib. Did not tryed compiling other exaple using directly compiled shaders.

As I said, trying to fix it I uninstalled Devkit pro, reinstalled latest version, compiled latest version of ctrulib and rebuilt all the libs from latest official source available.

Portlibs too compiled using Xerpi makefile.

To avoid problems with Phyton 2.7 (that isn't in my PATH variable, but on windows happens strange things), I renamed it's dir adding a slash.

I don't know what else I can do except installing everything om my Mint VM.
 

marc00077

Well-Known Member
Member
Joined
May 21, 2014
Messages
125
Trophies
0
Location
Catalunya
XP
192
Country
Netherlands Antilles
Yes.

Portlibs too compiled using Xerpi makefile.

As I said, trying to fix it I uninstalled Devkit pro, reinstalled latest version, compiled latest version of ctrulib and rebuilt all the libs from latest official source available.

To avoid problems with Phyton 2.7 (that isn't in my PATH variable, but on windows happens strange things), I renamed it's dir adding a slash.

I don't know what else I can do except installing everything om my Mint VM.
It's a common problem not yours. I had an old version of the lib and i have just installed it and compiled the sample that used to work great when I last compiled it, and now it's doing this weird texture thing, so my theory is that maybe a ctrulib update has introduced this bug? Could this be possible?
 

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy
I tryed an old version of ctrulib, but it's changing fast and wasn't able to compile the libs. I don't have time to try all the recent commits on githib :wacko:.

Probably it's aemstro that needs to be updated, but smealum itself says to use nihstro or picasso instead of aemstro for homebrews.

The xerpi's libs are very usefull and porting them to picasso shouldn't be very difficoult, but xerpi is busy on a lot of projects at the moment (including PS VITA HB).

When I back from holidays, if there isn't an update, I'll try to work on this too.
 
  • Like
Reactions: marc00077

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy
I don't thnk there are problems, it's open source and all the code is from xerpi. Uploading The .a file is enough, no need to post the headers file.

But if something is changed in ctrulib the compiled lib could not work or crash.

Another thing I can tru is uninstall Phyton 64 bit and install the 32 bit version.
 

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy
Yesterday fincs reverted a commit made 2 weeks ago on ctrulib and now everything works fine.

But IMHO porting the lib to picasso remains a good idea.
 
  • Like
Reactions: hippy dave

Technicmaster0

Well-Known Member
Member
Joined
Oct 22, 2011
Messages
4,420
Trophies
2
Website
www.flashkarten.tk
XP
3,545
Country
Gambia, The
I don't thnk there are problems, it's open source and all the code is from xerpi. Uploading The .a file is enough, no need to post the headers file.

But if something is changed in ctrulib the compiled lib could not work or crash.

Another thing I can tru is uninstall Phyton 64 bit and install the 32 bit version.
http://filetrip.net/dl?WP9DA64X5b there you go.
 

Rinnegatamante

Well-Known Member
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,858
Country
Italy
Hi man,
i started re-working on updates for lpp-3ds and i noticed that sf2dlib version i use is quite bugged for images.
When i load an image or create one from scratch and try to use it as a texture, my image looks with wrong colors (for example a red rectangle looks with strange blue lines on its surface.
What's wrong? Is an old sf2dlib problem or i'm wrong using sf2d texture feature?

Here's my code: https://github.com/Rinnegatamante/lpp-3ds/blob/master/source/luaGraphics.cpp
(Affected functions are: lua_loadimg and lua_drawimg . Image loading functions are stored here: https://github.com/Rinnegatamante/lpp-3ds/blob/master/source/include/graphics/Graphics.cpp )
 

nop90

Well-Known Member
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,136
Country
Italy
I can't check your code atm but a possible cause could be creating a texture from an image with a given bpp and dravibg it on a screen with a different bpp.
 

Suikoden77

Member
Newcomer
Joined
Feb 5, 2010
Messages
22
Trophies
1
XP
167
Country
Hello. I'm having some troubles trying to build the libraries. I think thay they are related with not having well installed ctrulib:
Code:
jorge@jorge-XubuntuBox:/opt/devkitpro/sf2dlib/libsf2d$ make
sf2d.c
arm-none-eabi-gcc -MMD -MP -MF /opt/devkitpro/sf2dlib/libsf2d/build/sf2d.d -g -Wall -O2 -march=armv6k -mtune=mpcore -mfloat-abi=hard -I/opt/devkitpro/sf2dlib/libsf2d/include -I/opt/devkitpro/libctru/include -I/opt/devkitpro/sf2dlib/libsf2d/build -DARM11 -D_3DS -c /opt/devkitpro/sf2dlib/libsf2d/source/sf2d.c -o sf2d.o
/opt/devkitpro/sf2dlib/libsf2d/source/sf2d.c:36:8: error: unknown type name 'aptHookCookie'
static aptHookCookie apt_hook_cookie;
        ^
/opt/devkitpro/sf2dlib/libsf2d/source/sf2d.c: In function 'sf2d_init_advanced':
/opt/devkitpro/sf2dlib/libsf2d/source/sf2d.c:79:2: warning: implicit declaration of function 'aptHook' [-Wimplicit-function-declaration]
  aptHook(&apt_hook_cookie, apt_hook_func, NULL);
  ^
/opt/devkitpro/sf2dlib/libsf2d/source/sf2d.c: In function 'sf2d_fini':
/opt/devkitpro/sf2dlib/libsf2d/source/sf2d.c:104:2: warning: implicit declaration of function 'aptUnhook' [-Wimplicit-function-declaration]
  aptUnhook(&apt_hook_cookie);
  ^
/opt/devkitpro/sf2dlib/libsf2d/source/sf2d.c: In function 'apt_hook_func':
/opt/devkitpro/sf2dlib/libsf2d/source/sf2d.c:284:14: error: 'APTHOOK_ONRESTORE' undeclared (first use in this function)
  if (hook == APTHOOK_ONRESTORE) {
              ^
/opt/devkitpro/sf2dlib/libsf2d/source/sf2d.c:284:14: note: each undeclared identifier is reported only once for each function it appears in
make[1]: *** [sf2d.o] Error 1
make: *** [build] Error 2

I have this exports:
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/devkitpro/devkitARM/bin
echo $DEVKITPRO
/opt/devkitpro
echo $DEVKITARM
/opt/devkitpro/devkitARM
echo $CTRULIB
/libctru/

Do you know what am I doing wrong !?
 

geocool

Well-Known Member
Newcomer
Joined
Jul 31, 2008
Messages
57
Trophies
0
Age
32
Location
Athens
XP
528
Country
Greece
xerpi thanks for this library.

I checked every post on this topic but nobody has asked the question:
Does the library work for a userland homebrew ? (with Ninjahax2,Ironhax)
 

Rinnegatamante

Well-Known Member
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,858
Country
Italy
xerpi thanks for this library.

I checked every post on this topic but nobody has asked the question:
Does the library work for a userland homebrew ? (with Ninjahax2,Ironhax)

Check if you can launch Asteroids 3D ( https://gbatemp.net/threads/release-asteroids-3d.385600/ ) [or any other app which use sf2dlib] and set GPU rendering on NH2, Ironhax.
If all works correctly, then sf2dlib works fine on newest haxs.
 

geocool

Well-Known Member
Newcomer
Joined
Jul 31, 2008
Messages
57
Trophies
0
Age
32
Location
Athens
XP
528
Country
Greece
@Rinnegatamante thanks for the quick answer.
Asteroid 3D works on both CPU & GPU. If it didn't support GPU would crash right ?
I noticed it has a lot of flickering in both CPU & GPU on top and bottom screen.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    Psionic Roshambo @ Psionic Roshambo: https://wccftech-com.cdn.ampproject.org/v/s/wccftech.com/amd-800-series-am5-motherboards-launch-r...