View previous topic :: View next topic |
Author |
Message |
Spectre
Joined: 07 Aug 2009 Posts: 6 Location: The third dimension with two-dimensional thoughts
|
Posted: Mon Aug 10, 2009 3:09 pm Post subject: 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? |
|
Back to top |
|
|
ps2devman
Joined: 09 Oct 2006 Posts: 265
|
Posted: Wed Aug 12, 2009 3:48 pm Post subject: |
|
|
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) |
|
Back to top |
|
|
Fakeuser
Joined: 01 Sep 2007 Posts: 15
|
|
Back to top |
|
|
ifcaro
Joined: 19 Oct 2008 Posts: 23
|
Posted: Mon Aug 17, 2009 11:24 pm Post subject: |
|
|
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: | gsGlobal->Mode = GS_MODE_NTSC;
gsGlobal->Interlace = GS_INTERLACED;
gsGlobal->Field = GS_FIELD;
gsGlobal->Width = 640;
gsGlobal->Height = 448; |
|
|
Back to top |
|
|
ps2devman
Joined: 09 Oct 2006 Posts: 265
|
Posted: Wed Aug 19, 2009 10:21 pm Post subject: |
|
|
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 |
|
Back to top |
|
|
Spectre
Joined: 07 Aug 2009 Posts: 6 Location: The third dimension with two-dimensional thoughts
|
|
Back to top |
|
|
Spectre
Joined: 07 Aug 2009 Posts: 6 Location: The third dimension with two-dimensional thoughts
|
Posted: Fri Aug 21, 2009 8:06 am Post subject: Bug |
|
|
In ./ps2_initial_fantasy/main.c:
Code: | *(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. |
|
Back to top |
|
|
ifcaro
Joined: 19 Oct 2008 Posts: 23
|
Posted: Fri Aug 21, 2009 8:15 am Post subject: Re: Bug |
|
|
Spectre wrote: | In ./ps2_initial_fantasy/main.c:
Code: | *(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 |
|
Back to top |
|
|
ps2devman
Joined: 09 Oct 2006 Posts: 265
|
Posted: Sat Aug 22, 2009 5:06 am Post subject: |
|
|
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) |
|
Back to top |
|
|
ifcaro
Joined: 19 Oct 2008 Posts: 23
|
Posted: Mon Aug 24, 2009 10:10 am Post subject: |
|
|
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. |
|
Back to top |
|
|
|