BufferDirty buffer

Parameters

buffer - any valid screen/image buffer

Description

A dirty buffer is a buffer that has been dynamically modified in the original system memory. BufferDirty tells DirectX to update the video memory copy of the buffer. This ensures the buffer is not lost when minimizing in fullscreen mode.

2D images that have been manually modified using WritePixel/WritePixelFast should be declared 'dirty' after you have finished modifying them. You can do this using the new BufferDirty() command, eg: BufferDirty ImageBuffer(image). If you don't care if such images survive loss of graphics, you can skip this.

See also: GraphicsLost.

Example

; BufferDirty

Graphics 640,480,0,1
SetBuffer BackBuffer()

image=CreateImage(64,64)

For iy=0 To ImageHeight(image)-1
For ix=0 To ImageWidth(image)-1
rgb=(ix*4) Or (iy*4 Shl 16)
WritePixel ix,iy,rgb,ImageBuffer(image)
Next
Next

BufferDirty ImageBuffer(image) ;Comment this out to see the difference

While Not KeyDown(1)
Cls

Text 0,0,"Press Alt-Tab to minimize the window"
DrawImage image,50,50

Flip
Wend
End

Index

Click here to view the latest version of this page online