English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 28 October 2010, 06:53   #1
NovaCoder
Registered User
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 3,703
AGA double buffering using ChangeScreenBuffer() - C++

Hiya,

I had a quick go at this but didn't get very far, has anyone actually got this working?


Here's my 'attempt'

Code:
void video_flipscreentask() {

    struct MsgPort *video_dispport = CreatePort(NULL, 0);
    struct MsgPort *video_safeport = CreatePort(NULL, 0);


    screenBuffer[drawBuffer]->sb_DBufInfo->dbi_DispMessage.mn_ReplyPort = video_dispport;
    screenBuffer[drawBuffer]->sb_DBufInfo->dbi_SafeMessage.mn_ReplyPort = video_safeport;

    // Wait for safe to draw.
    while(!GetMsg(video_dispport)) {
        Wait(1l<<(video_dispport->mp_SigBit));
    }



    c2p1x1_8_c5_bm_stub(320, 10, 0, 10, (UBYTE*)backBuffer->pixels, (UBYTE*)screenBuffer[drawBuffer ]->sb_BitMap);

    // Wait for safe to switch.
    while(!GetMsg(video_safeport)) {
        Wait(1l<<(video_safeport->mp_SigBit));
    }

    // Switch.
    ChangeScreenBuffer(video_screen, screenBuffer[drawBuffer]));

    
    drawBuffer = 1 - drawBuffer;




    // cleanup pending messages
    while(!GetMsg(video_dispport)) {
        Wait(1l<<(video_dispport->mp_SigBit));
    }

    DeletePort (video_dispport);

    // cleanup pending messages
    while(!GetMsg(video_safeport)) {
        Wait(1l<<(video_safeport->mp_SigBit));
    }

    DeletePort (video_safeport);


}

Last edited by NovaCoder; 29 October 2010 at 02:29.
NovaCoder is offline  
Old 03 November 2010, 00:34   #2
NovaCoder
Registered User
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 3,703
I got the same kind of results for simply doing this:

Code:
// Draw to back buffer.
c2p1x1_8_c5_bm_stub(320, 10, 0, 10, (UBYTE*)backBuffer->pixels, (UBYTE*)screenBuffer[drawBuffer ]->sb_BitMap);

// Flip.
while (ChangeScreenBuffer(video_screen, screenBuffer[drawBuffer]) == 0) {
/* do nothing! */ ;
}


drawBuffer = (1 - drawBuffer );
Looking at the API for ChangeScreenBuffer(), it returns 0 if it cannot do the flip so you have to do that wait while loop.
NovaCoder is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Triple buffering atchoo support.WinUAE 29 30 November 2011 11:58
lha buffering source support.Apps 7 18 July 2011 16:53
flawless double buffering dalton Coders. General 2 17 May 2011 07:09
Details of the AGA double CAS fetch mode? Leffmann Coders. General 3 29 July 2008 11:26
Double PAL / Double NTSC, oficially supported by WHDLoad... Shoonay project.WHDLoad 1 17 December 2005 17:05

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:52.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Page generated in 0.05681 seconds with 13 queries