Skip to content

CameraViewport

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

CameraViewport

CameraViewport:Void camera:Int32, x:Int32, y:Int32, width:Int32, height:Int32
Parameter Mode Type Default Description
camera In Int32 required Camera handle.
x In Int32 required Left edge of the viewport in the buffer.
y In Int32 required Top edge of the viewport in the buffer.
width In Int32 required Width of the viewport in pixels.
height In Int32 required Height of the viewport in pixels.

Description

Restricts the camera to a rectangle of the graphics buffer. Use it for split screen, a rear view mirror or a minimap. The camera keeps its aspect ratio from the size of the rectangle, so a narrow viewport does not squash the picture. Parts of the rectangle outside the buffer are cut off. The camera clears only its own rectangle, so two cameras with separate viewports can share one frame.

Examples

Graphics3D 320, 240, 0, 2
SetBuffer BackBuffer()
left = CreateCamera()
CameraViewport left, 0, 0, 158, 240
CameraClsColor left, 120, 30, 30
right = CreateCamera()
CameraViewport right, 162, 0, 158, 240
CameraClsColor right, 30, 60, 130
PositionEntity right, 0, 1.5, -2
RotateEntity right, 20, 0, 0
light = CreateLight()
RotateEntity light, 45, 45, 0
cube = CreateCube()
PositionEntity cube, 0, 0, 4
TurnEntity cube, 25, 30, 0
EntityColor cube, 240, 180, 60
RenderWorld
Flip
WaitKey

Media

CameraViewport

Related Commands

CameraClsColor, CameraClsMode, CameraCulling, CameraCullingSource, CameraFogColor, CameraFogMode, CameraFogRange, CameraProject

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally