Skip to content

SetBuffer

Narta Xaymar Dirks edited this page Oct 28, 2026 · 7 revisions

Blitz3DBlitzPlusBlitzBasic

SetBuffer

SetBuffer:Void buffer:Int32
Parameter Mode Type Default Description
buffer In Int32 required A buffer from BackBuffer, FrontBuffer, ImageBuffer or TextureBuffer.

Returns: BlitzPlus only: the buffer that was set before, so it can be set again later. Blitz3D gives nothing back.

Description

Chooses where drawing commands such as Rect, Text, DrawImage and Plot draw to: the back buffer, the front buffer, or the buffer of an image or texture. A program usually calls SetBuffer BackBuffer() once after Graphics. Switching the buffer puts the Origin and the viewport back to their defaults and the text cursor of Print to the top left corner.

Differences

  • A debug build (-d) stops with an error when the buffer is the TextureBuffer of a texture that was not made with flag 4096 (render target), see CreateTexture.
  • A buffer that does not exist stops the program with an error message.

Examples

Graphics 320, 240, 0, 2
SetBuffer BackBuffer()
Local img = CreateImage(100, 100)
SetBuffer ImageBuffer(img)
Color 255, 160, 0
Oval 0, 0, 100, 100, 1
Color 0, 0, 0
Text 50, 50, "image", 1, 1
SetBuffer BackBuffer()
Cls
For i = 0 To 2
	DrawImage img, 10 + i * 100, 30 + i * 30
Next
Flip
WaitKey

Media

SetBuffer

Related Commands

BackBuffer, BufferDirty, FrontBuffer, GraphicsBuffer, LoadBuffer, LockBuffer, SaveBuffer, UnlockBuffer

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally