Creating ViewPort

Blitz3D Forums/Blitz3D Programming/Creating ViewPort

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Graphics3D 800,600,32,2
Type player
Field cam
Field num
End Type

players = 4
For players_creation_loop=1 To players
p.player=New player
p\cam=CreateCamera()
p\num=players_creation_loop
;position camera wherever you want...

If players=2 Then 
If p\num=1 Then CameraViewport p\cam,0,0,GraphicsWidth(),GraphicsHeight()/2
If p\num=2 Then CameraViewport p\cam,0,GraphicsHeight()/2,GraphicsWidth(),GraphicsHeight()/2

ElseIf players>2

Select p\num

Case 1
CameraViewport p\cam,0,0,GraphicsWidth()/2,GraphicsHeight()/2
Case 2
CameraViewport p\cam,GraphicsWidth()/2,0,GraphicsWidth()/2,GraphicsHeight()/2
Case 3
CameraViewport p\cam,0,GraphicsHeight()/2,GraphicsWidth()/2,GraphicsHeight()/2

Case 4
CameraViewport p\cam,GraphicsWidth()/2,GraphicsHeight()/2,GraphicsWidth()/2,GraphicsHeight()/2
End Select


EndIf 



Next


cube=CreateCube()
MoveEntity cube,0,0,10
Repeat

TurnEntity cube,1,2,3
UpdateWorld
RenderWorld
Flip

Until KeyDown(1)
End


..should work..you set the width/height of the 2nd/3rd/4th cameras incorrectly.