Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DelphiX Multiple Draw

Status
Not open for further replies.

Jimyhunt

Programmer
Oct 13, 2005
12
GB
Hello,
Im creating a GUI with DelphiX. im using this to make it look good, when the images move quickly.

Which works fine, i get 60FPS, about the fastest possible frame rate.

But....(you know theres a but) when i add another draw box and draw on that the fps reduces to 30fps. and if i add another 20fps.

This is due to the draw box waiting for the horz refresh. which i require to stop "tearing". Each draw box waits for the horz refreash.

Is there any way to get them to refresh all together??

TIA

Jim
 
did you try to set doWaitVBlank to False?

I did some tests and it worked fine for me (with this flag set I get same FPS as you, ie 30FPS for 2 boxes)

disabling the flag delivered 150+ FPS for each box with no visible tearing effects (not for my animation though)

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Jim,
I found the "problem" part in DelphiX source, look at this:

Code:
procedure TDXDrawDriverBlt.Flip;
var
  pt: TPoint;
  Dest: TRect;
  DF: TDDBltFX;
begin
  pt := FDXDraw.ClientToScreen(Point(0, 0));

  if doStretch in FDXDraw.NowOptions then
  begin
    Dest := Bounds(pt.x, pt.y, FDXDraw.Width, FDXDraw.Height);
  end else
  begin
    if doCenter in FDXDraw.NowOptions then
    begin
      Inc(pt.x, (FDXDraw.Width-FDXDraw.FSurface.Width) div 2);
      Inc(pt.y, (FDXDraw.Height-FDXDraw.FSurface.Height) div 2);
    end;

    Dest := Bounds(pt.x, pt.y, FDXDraw.FSurface.Width, FDXDraw.FSurface.Height);
  end;

[b]  if doWaitVBlank in FDXDraw.NowOptions then
    FDXDraw.FDDraw.DXResult := FDXDraw.FDDraw.IDraw.WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, 0);[/b]

  DF.dwsize := SizeOf(DF);
  DF.dwDDFX := 0;

  FDXDraw.FPrimary.Blt(Dest, FDXDraw.FSurface.ClientRect, DDBLT_WAIT, df, FDXDraw.FSurface);
end;

the major challenge here is to create a "shared" flip routine for all TDXDraw boxes.
something like this :
set DoWaitVBlankOption to False
make a FlipAllBoxes procedure which detects all TDXDraw boxes, wait for VBlank and call Flip procedure of each individual box.

Don't have time to make an example but I hope you get the point...

Cheers,
Daddy



-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Thanks for the reply.[smile]

Yes, the doWaitVBlank has been set to false, and the problem goes away. This was one of my tests. i should i mentioned it.
[blush]

So my understanding from that code is that each Draw box waits for the vblank to occur. thus the problem above.

I will try to write a procedure to this. im not a delphi expert but i will give it ago.

i will let you know the result.

(Seems like a real fault in DelphiX doesnt it?)

Jim
 
I dont know where to start.[blush]

any pointers pls?
 
It's not really a bug since one would expect to do all the animation stuff in just one TDXDraw box.

I don't have the source code with me for the moment.

I'll try to post the soltuion tommorow :)

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Hay Daddy,

Still no joy getting it working. [blush]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top