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

  • Thread starter Thread starter xerpi
  • Start date Start date
  • Views Views 97,177
  • Replies Replies 501
  • Likes Likes 32
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 ?
 
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.
 
Solved. I found a set of .mk file for crosscompiling freetype2 for cortex from windows, and modified the files for the 3DS architecture.
 
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

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,
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.
 
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?
 
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
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.
 
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
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.
 
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 )
 
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.
 
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 !?
 
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)
 
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.
 
@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