Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Multiple viewports, what am I doing wrong????

Author
Message
Gordolfo
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location:
Posted: 27th Nov 2002 05:38
Hello,
I am trying to understand how multiple viewports work, and I almost got it (I think), I just can't get smooth motion.
What am I doing wrong?, I have a feeling it has something to do with the 'sync' commands, not sure I am using them right. If you run the code you will see that it runs SLOW...
Is there anything obviously or mayorly wrong that any of you guys can see???

Da code:

`Multiple viewports - Test 1

`set variables
PositionStartX=-100
PositionStep=2

` set resolution
set display mode 1024,768,16

Sync on
`sync rate 60

` create matrix, and place at specfic location
make matrix 1,200,200,10,10
position matrix 1,-100,-5,-100

`create cube
make object cube 1,10

`START LOOP
do
`increment position variable
PositionStartX = PositionStartX + PositionStep
`change object's position
position object 1,PositionStartX,0,0

`DRAW VIEWPORTS
`Top Left
Position Camera 3,50,-100
Point Camera Object Position X(1),Object Position y(1),Object Position z(1)
SET CAMERA VIEW 1,1,(Screen Width()/2),(Screen Height()/2)
sync
`Top Right
position camera 3,3,-100
point camera Object Position X(1),Object Position y(1),Object Position z(1)
SET CAMERA VIEW (Screen Width()/2)+1,1, Screen Width(),(Screen Height()/2)
sync
`Bottom Left
position camera -100,3,3
point camera Object Position X(1),Object Position y(1),Object Position z(1)
SET CAMERA VIEW 1,(Screen Height()/2)+1, (Screen Width()/2),Screen Height()
sync
`Bottom Right
position camera 3,-100,3
point camera Object Position X(1),Object Position y(1),Object Position z(1)
SET CAMERA VIEW (Screen width()/2)+1, (Screen Height()/2)+1, Screen Width(),Screen Height()
sync
`if at edge, then reverse direction
if PositionStartX=>100 or PositionStartX
Impreza
21
Years of Service
User Offline
Joined: 7th Nov 2002
Location:
Posted: 29th Nov 2002 23:31
you're syncing 4 times in one loop... which will really slow down your program; just do it once at the end before the 'loop' command

set mipmap mode 1: set matrix texture 1,1,1: set spot light 1,0,90: set normalization on: sync rate 0: statistic(1): flush video memory
autocam off: always active on: hide mouse: set window on

Login to post a reply

Server time is: 2024-04-19 07:18:12
Your offset time is: 2024-04-19 07:18:12