Raster Effect with Gendev ( SGDK)

SGDK only sub forum

Moderator: Stef

User avatar
Stef
Very interested
Posts: 2781
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Tue Oct 11, 2011 9:13 am

sega16 wrote:Using this code it will double SOME lines but not all.I believe the reason for this is because the code is not fast enough but what could I do to make it better?
If you have H Int at each scanline your code should fit in a very small amount of cycles : we have about 488 68k cycles by scanline but the SGDK H int handler already eat a part of it (about 120 cycles) so it leave 350 cycles for your code.

You don't have to check for end of screen as H Int doesn't happen during VBlank so you can do frame initialization process in the V Int callback instead.

your H Int code can be :

Code: Select all

    *((u16 *) GFX_DATA_PORT) = vscroll;
    if (the_scroll ^= 1) vscroll--;
Then your V Int code should end by :

Code: Select all

    ...
    // re init VScroll
    vscroll=0x800; 
    // prepare H Int V Scroll writes
    *((u32 *) GFX_CTRL_PORT) = GFX_WRITE_VSRAM_ADDR(0);

alko
Very interested
Posts: 149
Joined: Thu Aug 07, 2014 9:31 am
Location: Russian Federation

Re: Raster Effect with Gendev ( SGDK)

Post by alko » Thu Jan 14, 2016 8:15 pm

Shalom.

Please show me the complete source code of this effect (vertical scaling).
Image

alko
Very interested
Posts: 149
Joined: Thu Aug 07, 2014 9:31 am
Location: Russian Federation

Re: Raster Effect with Gendev ( SGDK)

Post by alko » Sat Jan 16, 2016 1:53 pm

8) I really need this effect 8)
Image

alko
Very interested
Posts: 149
Joined: Thu Aug 07, 2014 9:31 am
Location: Russian Federation

Re: Raster Effect with Gendev ( SGDK)

Post by alko » Wed Feb 10, 2016 6:39 pm

up...
Image

alko
Very interested
Posts: 149
Joined: Thu Aug 07, 2014 9:31 am
Location: Russian Federation

Re: Raster Effect with Gendev ( SGDK)

Post by alko » Wed Mar 30, 2016 12:48 pm

alko wrote:Shalom.

Please show me the complete source code of this effect (vertical scaling).
:oops: It is even possible to implement by means of SGDK?
Image

ehaliewicz
Interested
Posts: 43
Joined: Tue Dec 24, 2013 1:00 am

Re: Raster Effect with Gendev ( SGDK)

Post by ehaliewicz » Wed Mar 30, 2016 8:25 pm

alko wrote:
alko wrote:Shalom.

Please show me the complete source code of this effect (vertical scaling).
:oops: It is even possible to implement by means of SGDK?
What are you trying to do? Scaling sprites vertically?

Edit: nevermind, read the first page of the thread

alko
Very interested
Posts: 149
Joined: Thu Aug 07, 2014 9:31 am
Location: Russian Federation

Re: Raster Effect with Gendev ( SGDK)

Post by alko » Wed Mar 30, 2016 9:02 pm

Image

User avatar
Stef
Very interested
Posts: 2781
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Raster Effect with Gendev ( SGDK)

Post by Stef » Sat Apr 02, 2016 5:18 pm

Just use the h interrupt callback for that :)

Use :

Code: Select all

// Set H-Int callback
SYS_setHIntCallback(&hint_cb);
// enable H-Interrupt
VDP_setHInterrupt(1);
// set H-int line count occorence
VDP_setHIntCounter(1)
to define the hint callback method and enable H-Int for each scanline.
Then in the H-int callback you need to modify the Vertical scroll value using:

Code: Select all

void hint_cb()
{
  // modify vertical scroll
  VDP_setVerticalScroll(BPLAN, scrollValue);
}
of course you have to set a specific 'scrollValue' at each scanline to give scaling effect.

alko
Very interested
Posts: 149
Joined: Thu Aug 07, 2014 9:31 am
Location: Russian Federation

Re: Raster Effect with Gendev ( SGDK)

Post by alko » Mon Apr 04, 2016 5:45 pm

background is flattened, but an image is unstable.

Image

Code: Select all

....
static u32 vscrol;
void hint_cb()
{
   VDP_setVerticalScroll(PLAN_B, vscrol);
   vscrol += 8;
}

main()
{
...
while(TRUE)
{
...
SYS_setHIntCallback(&hint_cb);
VDP_setHInterrupt(1);
VDP_setHIntCounter(1);
VDP_waitVSync();   
}

}

Image

User avatar
Stef
Very interested
Posts: 2781
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Raster Effect with Gendev ( SGDK)

Post by Stef » Tue Apr 05, 2016 3:24 pm

Are you resetting 'vscrol' at V-Int ? looks like you aren't..

alko
Very interested
Posts: 149
Joined: Thu Aug 07, 2014 9:31 am
Location: Russian Federation

Re: Raster Effect with Gendev ( SGDK)

Post by alko » Tue Apr 05, 2016 5:52 pm

Stef wrote:Are you resetting 'vscrol' at V-Int ? looks like you aren't..
Oh, thanx! :roll:

Yet I keep getting flattened image.
How do stretch the picture?
Image

User avatar
Stef
Very interested
Posts: 2781
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Raster Effect with Gendev ( SGDK)

Post by Stef » Tue Apr 05, 2016 8:39 pm

Decrease 'vscrol' instead of increasing it =)
Using fix16 value will allow you to have smooth vertical scaling.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests