2D Rotation (libgs or gsKit, etc)?
-
- Posts: 6
- Joined: Fri Aug 07, 2009 12:03 pm
- Location: The third dimension with two-dimensional thoughts
2D Rotation (libgs or gsKit, etc)?
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?
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?
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)
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)
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)
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)
I compiled it but only reset my ps2 :Sps2devman 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)
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;
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
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
-
- Posts: 6
- Joined: Fri Aug 07, 2009 12:03 pm
- Location: The third dimension with two-dimensional thoughts
Umm...
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.
http://minilgos.perso.sfr.fr/ps2_gasp_vcl.zipps2devman 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_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.
-
- Posts: 6
- Joined: Fri Aug 07, 2009 12:03 pm
- Location: The third dimension with two-dimensional thoughts
Bug
In ./ps2_initial_fantasy/main.c:
My gsKit version is an unedited v0.2 (and compiles just fine), if that helps.
Code: Select all
*(p++)= ((th&3)<<30)|
(tw<<26)|
(texture->PSM<<20)|
(texture->TBW<<14)|
(texture->Vram>>8);
... Seems ../gsKit/gsInit.h doesn't have 'TBW' defined in the GSTEXTURE struct.MINGW32 wrote:main.c: In function `init_vu1':
main.c:174: structure has no member named `TBW'
make: *** [main.o] Error 1
My gsKit version is an unedited v0.2 (and compiles just fine), if that helps.
Re: Bug
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 :SSpectre 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);
... Seems ../gsKit/gsInit.h doesn't have 'TBW' defined in the GSTEXTURE struct.MINGW32 wrote:main.c: In function `init_vu1':
main.c:174: structure has no member named `TBW'
make: *** [main.o] Error 1
My gsKit version is an unedited v0.2 (and compiles just fine), if that helps.
Thanks Ps2devman but I already had it changed.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)
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.