Archived

This topic is now archived and is closed to further replies.

Jack C.

Clipper Wierdness

Recommended Posts

Hey all! I''m developing a game using DirectDraw 7 with 8bpp and at a 640x480 resolution (full screen). Things have been going fine with it, but I recently decided to try out using a directdraw clipper for my blits. While my blits turn out ok without it (using blt, not bltfast), when one is attached, everything gets messed up. Here''s a run down of what goes wrong: 1.)If I blit a bitmap to the screen, an exact copy of it will also be blitted next to it. It will also be shifted about one pixel higher. 2.)If I choose to make the SourceRect parameter smaller than the source surface that I''m blitting (ie. just blitting a part of a template surface to the screen), the program crashes. 3.)"Garbage" (a series of short, horizontal stripes) is also blitted to the screen below the bitmap (and its copy). 4.)If I clip the source surface off of the right or bottom sides of the screen, it wraps around. I''ve tried setting a handle to the window to the clipper and letting directdraw handle the region management instead of setting the clipper rects manually, and while this works, it only updates the client area of the window in full screen (leaving garbage along the top and sides), and it also only works for a primary surface (I''d rather just blit to the back and flip). Has anyone else experienced this stuff before? Any help would be greatly appreciated... Thanks

Share this post


Link to post
Share on other sites
I have no idea of what's causing you first problem but unless you need to set the clipping regions yourself I would go with the second solution and let DirectDraw handle the clipping for you.

The problem you had with that only the client area was updated is probably because you create your window wrong.
In fullscreen your window should be a popu window and created like this:
hwnd = CreateWindow("winclass", //The class we created before
"Direct3D Engine", //The title of the window
WS_POPUP / WS_VISIBLE,
0,0, //x,y start positions
basen.currmode.width, //Width of the window
basen.currmode.height, //Height of the window
NULL,
NULL, hinstance,
NULL)))


Your problem with you only being able to set the clipper to the primary surface is strange. I just realized that I had done the same. I am now recompiling my program and setting the clipper to the secondary surface to see what happens.

But heres a quote from the DirectX 6 SDK docs
quote:
This method is primarily used by surfaces that are being overlaid on or blitted to the primary surface. However, it can be used on any surface.


The program is now compiled and it worked just fine.
I create my clipper like this:
//Create the clipper for our window
if( FAILED( lpdd4->CreateClipper(0, &clipper, NULL)))
Error("Couldn't create the clipper");


//Set the window the clipper shold be attached to
if( FAILED( clipper->SetHWnd(0, hwnd)))
Error("Couldn't set the clipper to the window handle");

//Set the clipper to the secondary surface
if( FAILED( lpddssecondary->SetClipper(clipper)))
Error("Couldn't set the clipper to the primary surface");


I hope this will help you.


Edited by - Mr Cucumber on June 18, 2000 4:59:33 AM

Share this post


Link to post
Share on other sites