dxCameraViewport%(camera,x,y,width,height)

Parameters

camera - camera handle
x - x coordinate of top left hand corner of viewport
y - y coordinate of top left hand corner of viewport
width - width of viewport
height - height of viewport

Description

Sets the camera viewport position and size.

The camera viewport is the area of the 2D screen that the 3D graphics as viewed by the camera are displayed in.

Setting the camera viewport allows you to achieve spilt-screen and rear-view mirror effects.

Example

; dxCameraViewport Example
; ----------------------

dxGraphics3D 640,480
dxSetBuffer dxBackBuffer()

; Create first camera
cam1=dxCreateCamera()

; Set the first camera's viewport so that it fills the top half of the camera
dxCameraViewport cam1,0,0,dxGraphicsWidth(),dxGraphicsHeight()/2

; Create second camera
cam2=dxCreateCamera()

; Set the second camera's viewport so that it fills the bottom half of the camera
dxCameraViewport cam2,0,dxGraphicsHeight()/2,dxGraphicsWidth(),dxGraphicsHeight()/2

light=dxCreateLight()
dxRotateEntity light,90,0,0

plane=dxCreatePlane()
grass_tex=dxLoadTexture( "media/mossyground.bmp" )
dxEntityTexture plane,grass_tex
dxPositionEntity plane,0,-1,0

While Not dxKeyDown( 1 )

If dxKeyDown( 205 )=True Then dxTurnEntity cam1,0,-1,0
If dxKeyDown( 203 )=True Then dxTurnEntity cam1,0,1,0
If dxKeyDown( 208 )=True Then dxMoveEntity cam1,0,0,-0.05
If dxKeyDown( 200 )=True Then dxMoveEntity cam1,0,0,0.05

dxRenderWorld

dxText 0,0,"Use cursor keys to move the first camera about the infinite plane"

dxFlip

Wend

End

Index