Jump to content
  • Advertisement

Archived

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

Houdini

What good are Clippers for?

This topic is 6692 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

Other than putting a clipper on your backbuffer that allows you to not Blit past the edge of the screen, is there any other uses for it? Basically, in the game I''m designing I do not want the actual map to overwrite any game windows. If I use a clipper to negate any rects that will contain game windows, then I can''t actually draw the game windows either. The problem is that most of my windows will be "floating" windows, so I can''t just negate a whole side of the screen, so the only other option I can think of would be to draw the map over the whole screen, then draw the game windows afterwards (which is very slow because my interface windows use system mem instead of video ram, since they shouldn''t have to be rewritten to the screen every frame). Anyone have any ideas how I can do this without rewritting the game windows every frame?

Share this post


Link to post
Share on other sites
Advertisement
A clipper does exactly that... it clips. If I draw my man half-off the screen, only half of him appears.

If you''re using directX, be sure you''re "Blit"ing and not "BlitFast"ing. BltFast doesn''t clip.

Share this post


Link to post
Share on other sites
You are asking about DirectX clippers right?
I think Open GL has clippers too, but I''m not sure.

Clippers also go on your primary surface when you are not full screen (i.e. rendering to a window).

You can try blting your system mem windows onto an Overlay surface. An Overlay is in Video RAM. The overlay does not get blted to the primary or the back buffer. The RAMDAC "jumps" to your overlay where ever it exists and then jumps back to the primary. The bad part about Overlays is, they are not supported on most video cards (most of the 1998-1999 cards), or when ever they are supported, they are not very big.

Try looking at the DX "Mosquito" example. I''m using an 8MB ATI Xpert card (I know its more than a year old and it sucks too) and my mouse cursor is on top of the mosquito (explain that one!)

Hmmm. This depends on if you want real-time GUIs or non-real-time. That is do you have Windows on the screen, with animation, during game play? or do you just want dialog boxes for game options. If all you want is dialog boxes (without smooth animation and game play), the DX FSWindow sample does this.

If anyone can put a GDI-based Dialog Box (note that GDI already lets us change the appearance of the dialog to reflect the artwork in the game) on a Full screen drawing surface, and get smooth full frame buffer 3D animation, with continuous game play, I''d like to see it. I think this is another one of those parts part where where Microsoft got stingy with DirectX.

Share this post


Link to post
Share on other sites
Yes, i''m talking about using clippers in DirectDraw. And now that you mention Overlays, I believe that I might have been getting Clippers and Overlays confused. If I''m not mistaken, overlays allow you to do what I need to do, but when I tried using them WAY back when, my video card didn''t support it. Damn, I wish most video cards supported them, it would make my job a lot easier

And to answer your other question, I want both. I will have windows with buttons for specific game features showing during gameplay, as well as popup dialog boxes for option settings when the game is paused.

I guess my only other option is to try and stick everything into video ram so I can blt everything quickly. Seems like such a waste to redraw things that haven''t changed tho.

Share this post


Link to post
Share on other sites
With regard to clippers and clipping:

I never use the DirectX Clippers. I have had nothing but problems with them being slow or not running at all. Maybe I''m doing something wrong, maybe not, but I always write my own.

I have one function SetClipRect(RECT *pClipRect)which sets any rectangle to be the global clipping rectangle gClipRect.

I have two functions for blitting sprites Blit() and BlitClip(). The first ignores blitting and I only use it when I know I will never need to clip the sprite. I do this for animations and such that I want to run as fast as possible.

BlitClip() simply takes the provided x and y position that the sprite should be at, checks that (x + spriteWidth) and (y + spriteHeight) don''t exceed my gClipRect. I clip the left, right, top and bottom.

This works pretty fast and I like it. I really like this system because I can change my clipRect at any time while rendering a frame. I am making a map-based game, but when a user clicks on an object I set my clipRect to be a vertical bar that is the full screen''s height but only 150 pixels wide. I then set the clipRect back to full screen and continue to draw. The rest of the screen is black except for text next to the vertical bar describing the object clicked on. When the user pressed ESCAPE or OK, the clipRect gets expanded by a certain amount each frame until it is back to full size.

I would investigate this - using your own clipper can be optimized in assembler very easy, as well.

Share this post


Link to post
Share on other sites
I don''t know about the speed of the DirectDraw clipper, but you can set a list of rectangles for a clipping region if you want, or just clip to your window. There is an article on implementing a GUI in DirectX that I think implements a clipper.

Good Luck!




- null_pointer
Sabre Multimedia

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!