Here you go. Try this.
It starts out really fast for the first second or so, but then the limiter takes over and it runs normally.
Rem Project: Dark Basic Pro Project
Rem Created: Thursday, July 11, 2013
Rem ***** Main Source File *****
Rem Created By Mage Jul 10, 2013
Rem Re-Edited by JackDawson Jul 11, 2013
// LOAD THE DLL
load dll "kernel32.dll", 1
` Declare GLOBAL
GLOBAL fpsTotal
GLOBAL timebeforeRotation = 0
GLOBAL TheLimiter = 60 // This is the limiter
`Setup Screen
Set Display Mode 1024, 768, 32
Sync Rate 0
Sync On
Set Window On
`Make an Example Object
Make Object Cone 10, 1
Xrotate Object 10, -45
Position Object 10, 0, 0, 2
timebeforeRotation = fpsTotal / TheLimiter
Do
`Hold Shift to make the FPS lag as a test method
If ShiftKey() Then Wait 50
` Get FPS
fpsTotal = Screen Fps()
`Draw Screen messages
Text 20, 20, "Frame Rate:" + str$(fpsTotal)
`Get the timer
thetime = getthetime()
if thetime = 1
timebeforeRotation = timebeforeRotation + 1
if timebeforeRotation > fpsTotal / TheLimiter ` If the counter is greater then the FPS divided by the limter then it allows it to rotate.
` Then the counter is reset to 0. With this formula, it should be the same on any speed video card
` that can handle 60 FPS or better since the limiter is to 60.
timebeforeRotation = 0
YRotate Object 10, Object Angle Y(10) + 0.3
endif
endif
`Force the CPU to take a millisecond of sleep time for other processes that windows might need to make.
DLL_Sleeping(1)
`Draw The Screen
Sync
Loop
end
FUNCTION DLL_Sleeping(howmanyseconds) // This helps keep the CPU speed low when not in use
call dll 1, "Sleep", howmanyseconds
ENDFUNCTION
FUNCTION getthetime() // A Timer function
returnthenumber = 0
Elapsed=(Timer()-T)/1000
if Elapsed => 1
returnthenumber = 1
T=Timer()
endif
ENDFUNCTION returnthenumber
I have tested this with a FAST Windows 7 and a slow XP computers and I do not get any tearing on the screen. Set the limiter to 30 and try it on both FAST and SLOW computer at the same time. They both should spin about the same speed. Although in my tests the faster video card spins a tad faster. This is where you could get info on the GPU speeds and factor that into the math. There are many ways on how to do this.
Hope this works out for you.
https://soundcloud.com/toraktu