DirectDraw Fullscreen and Flickering
I have a problem with my DirectDraw video driver for my game. If I render many small surfaces (like a mouse pointer) or several small parts of surfaces (like for a font) it''s like surfaces/images are ripped diagonally from top left down right. The ripped edge is flickering (almost like anti-aliasing.)
That was the visual description of the bug. However I think it has something to do with the flipping. I use DDBLT_WAIT for all ''bliting'' and DDFLIP_WAIT when flipping. Alas it doesn''t seem to wait at all. It''s like some ''blits'' are not completed when the flipping occurs.
Everything works perfectly in windowed mode where the backsurface is created separately and the flipping procedure is to ''blit'' the backsurface to the primary surface.
Any ideas?
(I could send you the code if you email me pelle.lindstrand@swipnet.se)
[Environment: C/C++, MSVC++ 6.0, DX7.0A SDK, Windows 2000 Pro]
Q: Why do programmers always get Christmas and Halloween mixed up?
A: Because DEC 25 = OCT 31
In fullscreen mode you need to clear the enbtire surface atleast once. The reason is you are using a flipping change and although your copying data to the surface, you are leaving some memory space unused.
In windowed mode you don''t see this because Windows is handling the drawing, and is painting your window for you.
------------------------------
"I''m a decorated astronaut, I don''t make those kind of mistakes."
"Oh now wait a minute. Look I''ll show ya. I''ll enter the same calculations using what we like to call ''The Right Way''."
-Rem
Zirem Software
In windowed mode you don''t see this because Windows is handling the drawing, and is painting your window for you.
------------------------------
"I''m a decorated astronaut, I don''t make those kind of mistakes."
"Oh now wait a minute. Look I''ll show ya. I''ll enter the same calculations using what we like to call ''The Right Way''."
-Rem
Zirem Software
Shouldn''t this be sufficient
/*
--------
BeginRendering
--------
*/
DB_RESULT CVideoDirectDraw::BeginRendering()
{
LPDIRECTDRAWSURFACE7 lppds_dest = (_windowed ? _lpdds_back : _lpdds_primary);
HRESULT hr;
DDBLTFX ddbltfx;
DB_DD_INITSTRUCT(ddbltfx);
ddbltfx.dwFillColor = 0;
hr = lppds_dest->Blt(NULL,NULL,NULL,DDBLT_COLORFILL|DB_VID_DD_DEFAULT_BLT_FLAGS,&ddbltfx);
if (hr == DDERR_SURFACELOST) {
lppds_dest->Restore();
hr = lppds_dest->Blt(NULL,NULL,NULL,DDBLT_COLORFILL|DB_VID_DD_DEFAULT_BLT_FLAGS,&ddbltfx);
}
_clip_rect.left = 0;
_clip_rect.top = 0;
_clip_rect.right = _width;
_clip_rect.bottom = _height;
return DBE_OK;
}
/*
--------
BeginRendering
--------
*/
DB_RESULT CVideoDirectDraw::BeginRendering()
{
LPDIRECTDRAWSURFACE7 lppds_dest = (_windowed ? _lpdds_back : _lpdds_primary);
HRESULT hr;
DDBLTFX ddbltfx;
DB_DD_INITSTRUCT(ddbltfx);
ddbltfx.dwFillColor = 0;
hr = lppds_dest->Blt(NULL,NULL,NULL,DDBLT_COLORFILL|DB_VID_DD_DEFAULT_BLT_FLAGS,&ddbltfx);
if (hr == DDERR_SURFACELOST) {
lppds_dest->Restore();
hr = lppds_dest->Blt(NULL,NULL,NULL,DDBLT_COLORFILL|DB_VID_DD_DEFAULT_BLT_FLAGS,&ddbltfx);
}
_clip_rect.left = 0;
_clip_rect.top = 0;
_clip_rect.right = _width;
_clip_rect.bottom = _height;
return DBE_OK;
}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement