Jump to content
  • Advertisement


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


DirectDraw 7 Clipping problems

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

I am not a newbie to Visual Basic programming, but I am an extreme newbie to DirectX based programming through Visual Basic. I have learned the basics of DirectX and have created the start of an update to my old "API-BitBlt" based games. Everything was great until I found out that if I try to blt anything where a part could be offscreen, DirectDraw wouldn''t blit anything.... I attempt to invoke the Clipper object. If I attach the clipper object to the primary surface, the program runs normally except it still does not clip (which makes sense, since I am always blitting to the Backbuffer), However, if I attach the clipper to the backbuffer, whereas clipping is implemented (I believe) I cannot clear the screen thus everything is drawn over itself. Without the clipper everything works fine. My program is run with DirectDraw7, Fullscreen 800x600 in Visual Basic 6. Any help or small tutorial on how to clip the backbuffer would help and be greatly appreciated. HERE IS MY CODE TO INIALIZE THE PRIMARY SURFACE AND BACKBUFFER ClipRect(1).Top = 1: ClipRect(1).Left = 1 ClipRect(1).Right = 800: ClipRect(1).Bottom = 600 Set Ds = dx.DirectSoundCreate("") Ds.SetCooperativeLevel MainForm.hWnd, DSSCL_NORMAL On Local Error GoTo ErrOut Set Dd = dx.DirectDrawCreate("") Call Dd.SetCooperativeLevel(MainForm.hWnd, DDSCL_FULLSCREEN or DDSCL_EXCLUSIVE Or DDSCL_ALLOWREBOOT) Call Dd.SetDisplayMode(800, 600, 16, 0, DDSDM_DEFAULT) With DDsdPrimary .lFlags = DDSD_CAPS Or DDSD_BACKBUFFERCOUNT .ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE Or DDSCAPS_FLIP Or DDSCAPS_COMPLEX Or DDSCAPS_3DDEVICE .lBackBufferCount = 1 End With Set Primary = Dd.CreateSurface(DDsdPrimary) Set Clip = Dd.CreateClipper(0) ''Create a clipper... Clip.SetClipList 1, ClipRect ''Set up the clip list... Primary.SetClipper Clip '' Apply to Primary (No effect) Dim caps As DDSCAPS2 caps.lCaps = DDSCAPS_BACKBUFFER Or DDSCAPS_3DDEVICE Set BackBuffer = Primary.GetAttachedSurface(caps) BackBuffer.SetClipper Clip '' BY INVOKING THIS, I ELIMINATED REDRAW THIS IS MY BLIT PROCEEDURE Public Sub Blit(ByRef Destination As DirectDrawSurface7, DestX, Dy, Dw, Dh, ByRef Source As DirectDrawSurface7, Sx, Sy, Sw, Sh) With SrcRect .Bottom = Sy + Sh .Left = Sx .Right = Sx + Sw .Top = Sy End With With DestRect .Bottom = Dy + Dh .Left = DestX .Right = DestX + Dw .Top = Dy End With Destination.Blt DestRect, Source, SrcRect, DDBLT_KEYSRC Or DDBLT_WAIT End Sub AND THE FLIP Primary.Flip Nothing, DDFLIP_WAIT The program is quite large, so I just included the basic functions that are giving me a problem right now. Also, any info on incorporating DX8 effects would be helpful as well.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!