Are DDraw clippers slow???
🎉 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
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?
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
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);
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
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.
primsurf->Blt(&dest_rect, bitmap, &src_rect, NULL, NULL);
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.