How to scroll horizontally on a screen?
  • Order of the Butterfly
    Order of the Butterfly
    BalrogSoft
    Posts: 171 from 2006/10/6
    From: Spain
    Hello.

    I'm trying to make a scroll on a extended screen, the screen is a lowres mode (320x240), but screen size parameters are doubled (640x480). Vertical scroll is smooth using ScrollVPort, but for horizontal scroll aparently only works every 8 pixels. I have tried MoveScreen and ScreenPosition with identical results, how is the correct way to scroll a screen horizontally?

    Thanks in advance.

    [ Edited by BalrogSoft 24.06.2014 - 08:22 ]
    Balrog Software - AmigaSkool.net
    Mac Mini - MorphOS 3.8 - G4 1.5Ghz - Ati 9200 64 Mb
    Efika - MorphOS 3.6 - Ati 9200 64Mb - 80 Gb HD
    Amiga 1200D - OS 3.9 - Blizzard 603e/240mh
  • »23.06.14 - 21:31
    Profile Visit Website
  • MorphOS Developer
    jacadcaps
    Posts: 3146 from 2003/3/5
    From: Canada
    The correct way is to render your new screen contents in the back buffer and swap screen bitmaps with ChangeScreenBuffer() call.
  • »24.06.14 - 08:18
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    BalrogSoft
    Posts: 171 from 2006/10/6
    From: Spain
    Quote:

    jacadcaps wrote:
    The correct way is to render your new screen contents in the back buffer and swap screen bitmaps with ChangeScreenBuffer() call.


    There is a more efficient way that blitting a entire screen every frame when scroll position changes? ScrollVPort, ScreenPosition or MoveScreen works as expected on classic Amiga, but I can't get horizontal scroll working smoothly on MorphOS.

    [ Edited by BalrogSoft 24.06.2014 - 08:28 ]
    Balrog Software - AmigaSkool.net
    Mac Mini - MorphOS 3.8 - G4 1.5Ghz - Ati 9200 64 Mb
    Efika - MorphOS 3.6 - Ati 9200 64Mb - 80 Gb HD
    Amiga 1200D - OS 3.9 - Blizzard 603e/240mh
  • »24.06.14 - 09:27
    Profile Visit Website
  • MorphOS Developer
    jacadcaps
    Posts: 3146 from 2003/3/5
    From: Canada
    You are assuming that modern graphics hardware can display from just any memory address which does not have to be true for all chipsets out there. There are certain requirements like address alignments, modulos, etc.

    So again, the call you are trying to use is only for minimal legacy compatibility. What you should use is multi buffering (ChangeScreenBuffer).
  • »24.06.14 - 11:06
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    BalrogSoft
    Posts: 171 from 2006/10/6
    From: Spain
    Quote:

    jacadcaps wrote:
    You are assuming that modern graphics hardware can display from just any memory address which does not have to be true for all chipsets out there. There are certain requirements like address alignments, modulos, etc.

    So again, the call you are trying to use is only for minimal legacy compatibility. What you should use is multi buffering (ChangeScreenBuffer).


    I have implemented a double buffering with ChangeScreenBuffer already, but It doesn't solve my problem.

    The question is that I need a system function which changes the screen viewport position horizontally at 1 pixel level. Is this possible on MorphOS?

    How performs Ambient the scroll of screens bigger than screen mode size? It doesn't use the screen viewport?

    [ Edited by BalrogSoft 24.06.2014 - 12:59 ]
    Balrog Software - AmigaSkool.net
    Mac Mini - MorphOS 3.8 - G4 1.5Ghz - Ati 9200 64 Mb
    Efika - MorphOS 3.6 - Ati 9200 64Mb - 80 Gb HD
    Amiga 1200D - OS 3.9 - Blizzard 603e/240mh
  • »24.06.14 - 12:43
    Profile Visit Website
  • MorphOS Developer
    itix
    Posts: 1520 from 2003/2/24
    From: Finland
    Quote:

    BalrogSoft wrote:
    Quote:

    jacadcaps wrote:
    The correct way is to render your new screen contents in the back buffer and swap screen bitmaps with ChangeScreenBuffer() call.


    There is a more efficient way that blitting a entire screen every frame when scroll position changes? ScrollVPort, ScreenPosition or MoveScreen works as expected on classic Amiga, but I can't get horizontal scroll working smoothly on MorphOS.


    There is ScrollRaster() and ScrollRasterBF(). Which itself is probably calling some BltBitMap() internally but copying rectangles in video memory is fast.
    1 + 1 = 3 with very large values of 1
  • »24.06.14 - 15:36
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    BalrogSoft
    Posts: 171 from 2006/10/6
    From: Spain
    Quote:

    itix wrote:
    There is ScrollRaster() and ScrollRasterBF(). Which itself is probably calling some BltBitMap() internally but copying rectangles in video memory is fast.



    I'm aware that ScrollRaster works on MorphOS, but it's not exactly what I need, ScrollVPort lets show a window of a bigger screen without destroy its contents. I had probably to implement my own viewport solution for MorphOS adding an extra bitmap, and blitting this bitmap on screen buffer.

    Another question, what's the best way to detect MorphOS at runtime? Maybe checking Exec version with SysBase->LibNode.lib_Version?
    Balrog Software - AmigaSkool.net
    Mac Mini - MorphOS 3.8 - G4 1.5Ghz - Ati 9200 64 Mb
    Efika - MorphOS 3.6 - Ati 9200 64Mb - 80 Gb HD
    Amiga 1200D - OS 3.9 - Blizzard 603e/240mh
  • »24.06.14 - 17:48
    Profile Visit Website
  • MorphOS Developer
    Piru
    Posts: 588 from 2003/2/24
    From: finland, the l...
    Quote:

    what's the best way to detect MorphOS at runtime?

    Code:

    BOOL ismorphos = FindResident("MorphOS") != NULL;
  • »24.06.14 - 18:06
    Profile
  • MorphOS Developer
    jacadcaps
    Posts: 3146 from 2003/3/5
    From: Canada
    Quote:

    BalrogSoft wrote:
    The question is that I need a system function which changes the screen viewport position horizontally at 1 pixel level. Is this possible on MorphOS?



    There isn't one. Just as you cannot have a guarantee that the 320x240 or so mode you claim to be using is available. It may as well be displayed at 640x480 in which case all of your screen contents would be visible.
  • »24.06.14 - 19:32
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    BalrogSoft
    Posts: 171 from 2006/10/6
    From: Spain
    Problem solved, I have implemented my own viewport system when MorphOS is detected.

    Thanks you for your help!
    Balrog Software - AmigaSkool.net
    Mac Mini - MorphOS 3.8 - G4 1.5Ghz - Ati 9200 64 Mb
    Efika - MorphOS 3.6 - Ati 9200 64Mb - 80 Gb HD
    Amiga 1200D - OS 3.9 - Blizzard 603e/240mh
  • »24.06.14 - 23:25
    Profile Visit Website