🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

DirectDraw Clippers

Started by
19 comments, last by ZomeonE 24 years, 6 months ago
Please answer this simple question:

Are DDraw clippers slow???

Advertisement
Clippers should not really be impacting your preformance.
Do a comparison of: FPS with them and without them(If it doesn't crash)

Perhaps your misusing them? How many do you have attached to the backbuffer?

In my experience, they can be awfully slow.

My game uses clippers extensively, and there's a noticeable drop in performance when using certain drivers on my V550. I've found that the RIVA drivers tend to handle clippers fairly well, and that the default Viper drivers do not.

If anyone has any other information on this, I'd love to hear it.

Mason McCuskey
Spin Studios
www.spin-studios.com

Founder, Cuttlefish Industries
The Cuttlefish Engine lets anyone develop great games for iPad, iPhone, Android, WP7, the web, and more!
I've only got one attached to the backbuffer and I'm not missusing them in any way I know. Anyway, I've written something without clippers and here is the code. But there's one problem. The Blt(...) function won't work with a source RECT.

	RECT dest;	RECT src;	int i=1, ii=1;	int dx, dy;	if (pos_x < 0) pos_x = 0;	if (pos_y < 0) pos_y = 0;	pos_x+=2;	pos_y+=2;	dx = pos_x - ((pos_x / TILE_WIDTH)*TILE_WIDTH);	dy = pos_y - ((pos_y / TILE_HEIGHT)*TILE_HEIGHT);	src.top = 1;	src.left = 1;	src.bottom = TILE_HEIGHT;	src.right = TILE_WIDTH;	for (i=0;i<=8;i++)	{		dest.top = i * TILE_HEIGHT - dy;		if (i==0) dest.top = 0;		dest.bottom = i * TILE_HEIGHT - dy + TILE_HEIGHT;		src.top = 0;		if (i==0) src.top = TILE_HEIGHT - dy;		src.bottom = TILE_HEIGHT;		for (ii=0;ii<=11;ii++)		{			dest.left = ii * TILE_WIDTH - dx;			if (ii==0) dest.left = 0;			dest.right = ii * TILE_WIDTH - dx + TILE_WIDTH;			src.left = 0;			if (ii==0) src.left = TILE_WIDTH - dx;			src.right = TILE_WIDTH;			primsurf->Blt(&dest, bitmap, &src, NULL, NULL);		}	}		while(primsurf->Flip(NULL, DDFLIP_WAIT)!=DD_OK);

Please help me!
why dont you make your own its not that hard really

------------------

------------------------------"My sword is like a menacing cloud, but instead of rain, blood will pour in its path." - Sehabeddin, Turkish Military Commander 1438.
The problem with writing your own is that the DDraw clippers do more than you think.

They can clip against a *series* of rectangles, including ones that partially overlap each other. Because of this, they're a great tool in GUI design.

If all you need is simple "draw only inside this rectangle" clipping, writing your own is an option... but if you need more complex clipping, the speed hit may be worth the development time saved.

Mason McCuskey
Spin Studios
www.spin-studios.com

Founder, Cuttlefish Industries
The Cuttlefish Engine lets anyone develop great games for iPad, iPhone, Android, WP7, the web, and more!
I have to agree with mason.
For what you are doing, create you're own clipper, the use bltfast vs blt.

You might also try to combine a run of tiles, into one single blt. That could get you a preformance increase.

Ok, but can't i use a souce rect and a dest rect with the Blt function to make "a form of clippers"??

primsurf->Blt(&dest_rect, bitmap, &src_rect, NULL, NULL);

Why not use bltfast?

Last time I wrote a tile based thing I used bltfast changed the rect to only display teh bits of tiles needed on the edge of the screen and it ran realy well.

This topic is closed to new replies.

Advertisement