DOUBLE BUFFER C++/WIN32? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

DOUBLE BUFFER C++/WIN32?

1. Which class can represent a (fast) double buffer?

2. How do I draw to it?

3. How do I draw it to the screen?



Any help will be appreciated. Thanks.


Comments

  • how do you draw to the screen?



    assuming that...

    LPDIRECTDRAWSURFACE4 lpddsprimary = NULL;



    you flip it like this:



    lpddsprimary->Flip(NULL, DDFLIP_WAIT);



    how do you draw to the 2x buffer? depends on what you wanna draw. lines? pixels? bitmaps?



    just e-mail me: [email protected]













    : 1. Which class can represent a (fast) double buffer?

    : 2. How do I draw to it?

    : 3. How do I draw it to the screen?

    :

    : Any help will be appreciated. Thanks.

    :






  • Christinme7890Christinme7890 Posts: 6Member
    : how do you draw to the screen?
    :
    : assuming that...
    : LPDIRECTDRAWSURFACE4 lpddsprimary = NULL;
    :
    : you flip it like this:
    :
    : lpddsprimary->Flip(NULL, DDFLIP_WAIT);
    :
    : how do you draw to the 2x buffer? depends on what you wanna draw. lines? pixels? bitmaps?
    :
    : just e-mail me: [email protected]
    :
    :
    :
    :
    :
    :
    : : 1. Which class can represent a (fast) double buffer?
    : : 2. How do I draw to it?
    : : 3. How do I draw it to the screen?
    : :
    : : Any help will be appreciated. Thanks.
    : :
    There is more stuff you have to do to initiate the direct draw primary buffer. First off you also need to create a secondary buffer:
    LPDIRECTDRAWSURFACE4 lpddsprimary=NULL;
    LPDIRECTDRAWSURFACE4 lpddssecond=NULL;

    ZeroMemory(&ddsd,sizeof(ddsd));
    ddsd.dwSize = sizeof( ddsd );
    ddsd.dwBackBufferCount = 1;//tells how many back buffers there //are
    ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
    ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
    lpDD->CreateSurface( &ddsd, &lpDDSPrimary, NULL );
    //back buffer
    ddscaps.dwCaps=DDSCAPS_BACKBUFFER;
    lpddsprimary->GetAttachedSurface(&ddscaps,&lpddssecond);

    any questions please post your question

Sign In or Register to comment.