Skip to main content
GameDev.net gamedev.net
🔒 Locked

DDraw question

Started by xropi Jan 6, 2003 at 7:42 AM 0 replies 200+ views
Original Post
xropi
xropi
I've experienced poor image quality while rendering an image to the primary surface when there are overlapping windows on top of the blitted image. There are annoying horizontal image errors according to the window position. (DX7 is in use)

Here is my little code fragment in Delphi:
    
  try
    hr := FDirectDraw.SetCooperativeLevel(ViewPanel.Handle, DDSCL_NORMAL);
    if hr <> DD_OK then raise Exception.Create(DDErrorString(hr));
 
    SurfaceDesc.dwSize := sizeof(SurfaceDesc);
    SurfaceDesc.dwFlags := DDSD_CAPS;
    SurfaceDesc.ddsCaps.dwCaps := DDSCAPS_PRIMARYSURFACE;
 
    hr := FDirectDraw.CreateSurface(SurfaceDesc, FPrimarySurface, nil);
    if hr <> DD_OK then raise Exception.Create(DDErrorString(hr));
 
    hr := FDirectDraw.CreateClipper(0, FClipper, nil);
    if hr <> DD_OK then raise Exception.Create(DDErrorString(hr));
 
    hr := FClipper.SetHWnd(0, ViewPanel.Handle);
    if hr <> DD_OK then raise Exception.Create(DDErrorString(hr));
 
    hr := FPrimarySurface.SetClipper(FClipper);
    if hr <> DD_OK then raise Exception.Create(DDErrorString(hr));
  except
    On E : Exception do
    begin
      ErrDlg(Format(rssErrorInitDirectDraw, [E.Message]));
      raise Exception.Create('TCameraView.Create:' + E.Message); //!!!!!

    end;
  end;
    
I suppose I have a problem with the incorrect setting of the clipper object, but I'm not sure. Any idea? [edited by - xropi on January 6, 2003 8:43:29 AM]
I'm interested in full featured 3D system development.
olle55
olle55
I used to have the exact same problem whan i was working on my first game, never figured out what it was causing it. When you moved a window above the dx window it seemed to mess up the graphic along with the top of that window. I remember that i tough that maybe it had something with TextOut() to do, but i never investigated it.


I am working on my second game now, i rewrote the dx code from scratch, and i dont have that problem anymore.

I was not using a clipper in any of my games.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.