Results 1 to 9 of 9

Thread: backbuffer

  1. #1


    So, ok here is my code. Everybody copy it and run project and see the flickering please. Why does it flicker? How can I avoid flickering ? Does backbuffer work or what is the problem?
    Please add DXDraw, DXTimer and DXInput to your form and make DXTimer1.Interval := 0 and DXTimer1.Enabled := False;
    ************************************************** **********
    Form1: TForm1;
    MySurface: TDirectDrawSurface; // my image's surface
    LeftRight, PointX, PointY: word;


    {$R *.dfm}

    procedure TForm1.FormCreate(Sender: TObject);
    DXDraw1.Options := DXDraw1.Options + [DoFullScreen];
    DXDraw1.Display.Width := 1024;
    DXDraw1.Display.Height := 768;
    DXDraw1.Width := 800;
    DXDraw1.Height := 600;

    procedure TForm1.DXDraw1Initialize(Sender: TObject);
    MySurface := TDirectDrawSurface.Create(DXDraw1.DDraw);
    MySurface.LoadFromFile(extractfilepath(paramstr(0) )+'your favourite 100 * 75 bmp file');
    DXTimer1.Enabled := True;

    procedure TForm1.DXTimer1Timer(Sender: TObject; LagCount: Integer);
    if isleft in DXInput1.States then
    Dec(LeftRight, 1);
    if isRight in DXInput1.States then
    Inc(LeftRight, 1);
    PointX := Form1.ClientOrigin.X + DXDraw1.Left + LeftRight;
    PointY := Form1.ClientOrigin.Y + DXDraw1.Top;
    DXDraw1.Primary.StretchDraw(Rect(PointX, PointY, PointX + DXDraw1.Width, PointY + DXDraw1.Height), MySurface.ClientRect, MySurface,False);

    procedure TForm1.DXDraw1Finalize(Sender: TObject);

    ************************************************** **********

    Note: Hi, I'm Poseidon and I'm sending this message from my friend's computer and I've used anubis79 nickname and a new topic. Sorry...

    [edit by BlueCat - [ pascal ] tags are so useful ]

  2. #2


    I'm not sure what the problem is, but everything seems to work okay for me. No flickering whatsoever

  3. #3


    Do you use DoFlip option, Traveler? If you use I should say yes it isn't flicker. But I can't use this option because I use some buttons and panels in my project in full_screen mode and If I make DoFlip everything without DXDraw1 and it's image are disappeared. I know it's DoFlip option's behaviour.

  4. #4


    Activating or deactivating doFlip doesn't change much. There's still no flickering. The only way I get a flicker is when I add DXDraw1.flip to the onTimer event.

    But why use DXDraw1.Primary.StretchDraw and not DXDraw1.Surface.StretchDraw?

  5. #5


    I don't prefer to use DXDraw1.Surface and it's methods. Especially DXDraw1.Flip is slower than drawing directly to the primary surface. Do you agree?
    But when I talked with you, I realized that my DXDraw.Width is 800 and if I draw my image in it there is no flicker, but if some part of my image is drawn anywhere on the screen(on the primary) where this point isn't in DXDraw's limits and this part of image can't be seen by the user it is flicker like crazy. So, I'd like to ask you: When you said there is no flicker, were you drawing your image on DXDraw completely (where you drawing it in the DXDraw's limits)? And your answer is yes, can we say primary's backbuffer is only valid for DXDraw's limits?

    Note: If this isn't clear, I can give you an example.

  6. #6


    Primary.draw indeed does appears to be much faster than surface.draw.
    I have however no experience using it, so I can't really tell if there are any side effects or do's or dont's.

    As for the example. I have used a clean setup, straight from the component palette. No options modified and all code came from your messsage. So as far as I can tell, it's should be the same as yours.

  7. #7


    Now, I'm thinking may be a difference between your and my DirectX version or your video card and my video card. Can you tell me yours and configurations traveler?

    Also, Are there anybody like Traveler who say there is no flicker. Please everybody tell me your's result if you try the code. Does this matter result from my computer? What is your opinion?

  8. #8


    I do not think it has something to do with the gpu or DirectX. But anyway, i'm currently running at DirectX 8 with a radeon 7500.

  9. #9


    Thank you all your replies Traveler.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Comodo SSL