Archived

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

Problems with clipping

This topic is 6018 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am making a game and am having some problems with the clipper. Basically, it''s not working the way I think it should. The game is windowed and using DirectX 7. Using my tiling engine, whenever the tiles go partially out of the clipping area, the whole tile disappears instead of a partial tile being drawn. I''m not using BltFast() and I don''t understand the problem. If anyone could help, I would really appreciate it. Thanks, Soulkeeper I''''m learning, just like the best of us...

Share this post


Link to post
Share on other sites
Is it a 2D tiling engine?
If so, do you have your tile grid atleast 1 tile bigger than the size of the screen to make up for the edge tiles not being aligned?

Maybe if you can be more specific as to how you do your tile drawing and clipping...

Share this post


Link to post
Share on other sites
Hi,

Yes, it's a 2d tiling engine.
The tile grid matches the screen size.

I just checked the clipping a bit by blitting to the primary surface and it works.

First a story:

I am using a "backbuffer" and "flipping" it with the primary surface of the window. Basically, it uses double buffering. What

I want to know is: The clipper is attached to the primary surface. If I attach it to the backbuffer, then only the bottom right corner of the screen is animated. If I make the back buffer bigger then the graphics is screwed up. I want to know how to attach it to the "backbuffer" and still have the whole screen animate.

Soulkeeper

Edited by - Soulkeeper on June 21, 2001 12:34:55 AM

Share this post


Link to post
Share on other sites
The clipper should be attached to the backbufer, since that''s
where you''re blitting your tiles to. The primary surface is only
written to by the backbuffer, which should be the same size, so
no need for a clipper there.

This is my clipper creation code, works fine...
(I removed all the error checking to make it shorter...)

RECT r;
SetRect( &r, 0, 0, screenWidth, screenHeight );

regionData = (LPRGNDATA)malloc(sizeof(RGNDATAHEADER) + sizeof(RECT));
memcpy(regionData->Buffer,&r,sizeof(RECT));

regionData->rdh.dwSize = sizeof(RGNDATAHEADER);
regionData->rdh.iType = RDH_RECTANGLES;
regionData->rdh.nCount = 1;
regionData->rdh.nRgnSize = sizeof(RECT);
regionData->rdh.rcBound.left = r.left;
regionData->rdh.rcBound.top = r.top;
regionData->rdh.rcBound.right = r.right;
regionData->rdh.rcBound.bottom = r.bottom;

lpDD->CreateClipper(0,&lpDDClipper,NULL);
lpDDClipper->SetClipList(regionData,0);
lpDDSBack->SetClipper(lpDDClipper);

free(regionData);

Share this post


Link to post
Share on other sites