Page 1 of 1
2D Rotation (libgs or gsKit, etc)?
Posted: Mon Aug 10, 2009 3:09 pm
by Spectre
In terms of simplicity, which library would be best to use for 2D sprite rotation/animation? I've seen the awesome power of properly coded libgs applications, but can't find anything in regards to rotation... Which leads me to believe that sequentially rotated image frames would have to be preloaded into vram to get the job done. Too wasteful for my tastes, yet still functional enough to help me get by.
From what I've gathered in studying gsKit, I'd have to use textured quads for 2D sprites (much like OpenGL or DirectX8+), using gsKit_prim_sprite_texture & gsKit_prim_quad_texture_3d. I'm not too knowledgeable on using 3D math for simple 2D projections... but for rotations, I'm assuming it'd be as simple as spinning the 2D primitive from it's central origin (along the Z axis)?
Is there something I'm missing? What's the best way to get the job done?
Posted: Wed Aug 12, 2009 3:48 pm
by ps2devman
You can start with initial fantasy 3D engine.
Since you can provide your 3DS mesh and a texture, you can
easily just draw a textured square in space at a constant Z
(example supplies a textured fighter or a textured biplane)
http://minilgos.perso.sfr.fr/ps2_initial_fantasy.zip
(it uses the professional game devs method : full speed dma transferts
there is a bit of gskit just for a few text and line drawing and inits)
Posted: Sun Aug 16, 2009 1:46 pm
by Fakeuser
Hi,ps2devman,Wonderful example!Thank you!
Where can i get following examples mentioned in readme.txt?
url seems broken.
http://home.tele2.fr/~fr-51785/ps2_qbert.zip (2D sprites)
http://home.tele2.fr/~fr-51785/ps2_pong.zip (wiimote)
http://home.tele2.fr/~fr-51785/ps2_afl_pktdrv.zip (packet driver)
Posted: Mon Aug 17, 2009 11:24 pm
by ifcaro
ps2devman wrote:You can start with initial fantasy 3D engine.
Since you can provide your 3DS mesh and a texture, you can
easily just draw a textured square in space at a constant Z
(example supplies a textured fighter or a textured biplane)
http://minilgos.perso.sfr.fr/ps2_initial_fantasy.zip
(it uses the professional game devs method : full speed dma transferts
there is a bit of gskit just for a few text and line drawing and inits)
I compiled it but only reset my ps2 :S
EDIT: I added this in system.c and now works :D
Code: Select all
gsGlobal->Mode = GS_MODE_NTSC;
gsGlobal->Interlace = GS_INTERLACED;
gsGlobal->Field = GS_FIELD;
gsGlobal->Width = 640;
gsGlobal->Height = 448;
Posted: Wed Aug 19, 2009 10:21 pm
by ps2devman
Thank you all for trying and fixing.
I had to change my ISP (my ISP got actually bought by another one)
replace
http://home.tele2.fr/~fr-51785 with the new path and you
will find other files
Posted: Fri Aug 21, 2009 6:54 am
by Spectre
Umm...
ps2devman wrote:Thank you all for trying and fixing.
I had to change my ISP (my ISP got actually bought by another one)
replace
http://home.tele2.fr/~fr-51785 with the new path and you
will find other files
http://minilgos.perso.sfr.fr/ps2_gasp_vcl.zip
http://minilgos.perso.sfr.fr/ps2_qbert.zip (2D sprites)
http://minilgos.perso.sfr.fr/ps2_pong.zip (wiimote)
http://minilgos.perso.sfr.fr/ps2_afl_pktdrv.zip (packet driver)
PS: Thanks, ps2devman! Very clean & informational stuff, there.
Bug
Posted: Fri Aug 21, 2009 8:06 am
by Spectre
In
./ps2_initial_fantasy/main.c:
Code: Select all
*(p++)= ((th&3)<<30)|
(tw<<26)|
(texture->PSM<<20)|
(texture->TBW<<14)|
(texture->Vram>>8);
MINGW32 wrote:main.c: In function `init_vu1':
main.c:174: structure has no member named `TBW'
make: *** [main.o] Error 1
... Seems
../gsKit/gsInit.h doesn't have
'TBW' defined in the
GSTEXTURE struct.
My gsKit version is an unedited v0.2 (and compiles just fine), if that helps.
Re: Bug
Posted: Fri Aug 21, 2009 8:15 am
by ifcaro
Spectre wrote:In
./ps2_initial_fantasy/main.c:
Code: Select all
*(p++)= ((th&3)<<30)|
(tw<<26)|
(texture->PSM<<20)|
(texture->TBW<<14)|
(texture->Vram>>8);
MINGW32 wrote:main.c: In function `init_vu1':
main.c:174: structure has no member named `TBW'
make: *** [main.o] Error 1
... Seems
../gsKit/gsInit.h doesn't have
'TBW' defined in the
GSTEXTURE struct.
My gsKit version is an unedited v0.2 (and compiles just fine), if that helps.
I have compiled the latest code from svn and it has worked. But sometimes I get the error "ERROR: Not enough VRAM for this allocation!" when trying to make pal mode or for some reason I dont know :S
Posted: Sat Aug 22, 2009 5:06 am
by ps2devman
dmaKit_init(D_CTRL_RELE_OFF, D_CTRL_MFD_OFF, D_CTRL_STS_UNSPEC,
D_CTRL_STD_OFF, D_CTRL_RCYC_8);
...to:
dmaKit_init(D_CTRL_RELE_OFF, D_CTRL_MFD_OFF, D_CTRL_STS_UNSPEC,
D_CTRL_STD_OFF, D_CTRL_RCYC_8, 1 << DMA_CHANNEL_GIF);
in system.c
(it's a note I took from other users posting fixes as well)
Posted: Mon Aug 24, 2009 10:10 am
by ifcaro
ps2devman wrote:dmaKit_init(D_CTRL_RELE_OFF, D_CTRL_MFD_OFF, D_CTRL_STS_UNSPEC,
D_CTRL_STD_OFF, D_CTRL_RCYC_8);
...to:
dmaKit_init(D_CTRL_RELE_OFF, D_CTRL_MFD_OFF, D_CTRL_STS_UNSPEC,
D_CTRL_STD_OFF, D_CTRL_RCYC_8, 1 << DMA_CHANNEL_GIF);
in system.c
(it's a note I took from other users posting fixes as well)
Thanks Ps2devman but I already had it changed.
The problem was that when loading the texture, did not have enough VRAM.
I solved by disabling DoubleBuffering, I dont know if this will change something.
PS:
Here is the file vu.c edited to eliminate warnings when compiling.