"Lite regulation" function ('regulateLite()') to be integrated into user loop for FPS control

Post your FreeBASIC source, examples, tips and tricks here. Please don’t post code without including an explanation.
fxm
Moderator
Posts: 12133
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: "Lite regulation" function ('regulateLite()') to be integrated into user loop for FPS control

Post by fxm »

Right or Wrong user code to remove the 'skipped images' tagged by 'regulateLite()'

The small graphic test code below (with a graphic progress bar) allows to select either a Right user code (key <R>) or a Wrong user code (key <W>), code dedicated to remove the 'skipped images' tagged by 'regulateLite()'.
The offending user code concerns a single code line ('l=(l+1) Mod 640') which commands the graphic progress bar.

As long as the requested FPS does not induce 'skipped images' by 'regulateLite()' ("Image displayed : 1/1" for low FPS), there is obviously no visual difference between the Right and Wrong user code (for example for requested FPS = 20 on my Windows PC).

As soon as 'skipped images' are tagged by 'regulateLite()' ("Image displayed : 1/N" with 'N > 1' for higher FPS), the Wrong user code induces an apparent FPS which is divided by 'N' compared to the requested FPS (although the FPS returned by 'regulateLite()' says the opposite), while the Right user code induces the correct apparent FPS (for example for requested FPS = 100 on my Windows PC).

Test code with Right or Wrong user code (to remove the 'skipped images' tagged by 'regulateLite()'):

TestRightWrongUserCode:

Code: Select all

#include "regulateLite.bi"  '' defined in https://www.freebasic.net/forum/viewtopic.php?p=299929#p299929

Screen 12
Dim As Ulong FPS = 100
Do
    Static As ULongInt l
    Static As Ulong MyFPS
    Static As Boolean ImageSkipped
    Static As Long nis
    Static As Long tnis
    Static As Ulong averageMyFPS
    Static As Double sumMyFps
    Static As Long N
    Static As Boolean bug
    If ImageSkipped = False Then
        ScreenLock
        Cls
        Color 15
        Print Using "Requested FPS        : ###"; FPS
        Print
        Color 11
        Print Using "Applied FPS returned : ###   (average : ###)"; MyFPS; averageMyFps
        Print "   Image displayed   : 1/" & tnis + 1
        Print
        If bug = False Then
            Color 10
            Print "Right ";
            Color 11
            Print "user code to remove 'skipped images' :"
            Print Using "   True apparent FPS = ###   (average : ###)"; MyFPS; averageMyFPS
        Else
            Color 12
            Print "Wrong ";
            Color 11
            Print "user code to remove 'skipped images' :"
            Print Using "   True apparent FPS = ###   (average : ###)"; MyFPS / (tnis + 1); averageMyFPS / (tnis + 1)
        End If
        Print
        Print
        Print
        Color 14
        Print "<+>      : Increase FPS"
        Print "<->      : Decrease FPS"
        Print
        Print "<r> Or <R> : Right user code to remove 'skipped images'"
        Print "<w> Or <W> : Wrong user code to remove 'skipped images'"
        Print
        Print "<Escape> : Quit"
        Line (0, 128)-(639, 144), 7, B
        Line (0, 128)-(l, 144), 7, BF
        ScreenUnlock
        If bug = True Then l = (l + 1) Mod 640
    End If
    If bug = False Then l = (l + 1) Mod 640
    Dim As String s = Ucase(Inkey)
    Select Case s
    Case "+"
        If FPS < 400 Then FPS += 1
    Case "-"
        If FPS > 10 Then FPS -= 1
    Case "R"
        bug = False
    Case "W"
        bug = True
    Case Chr(27)
        Exit Do
    End Select
    MyFPS = regulateLite(FPS, , , ImageSkipped)
    If ImageSkipped = True Then
        nis += 1
    Else
        tnis = nis
        nis = 0
    End If
    sumMyFPS += MyFPS
    N += 1
    If N >= MyFPS / 2 Then
        averageMyFPS = sumMyFPS / N
        N = 0
        sumMyFPS = 0
    End If
Loop
Last edited by fxm on Aug 18, 2023 5:09, edited 3 times in total.
Reason: Updated code.
fxm
Moderator
Posts: 12133
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: "Lite regulation" function ('regulateLite()') to be integrated into user loop for FPS control

Post by fxm »

An eleventh graphic animation highlighting the interest of the image skipping feature of 'regulateLite()',
with scrolling and above all removing of skipped images


The graphic animation (heavy CPU load) comes from dodicat : Here.
Some initializations and code lines may have been modified from the author's original in order to better highlight the regulation with 'regulateLite()' and its different configurations of use.

This test code allows to modify:
- the value of the requested FPS (and it visualizes the applied FPS),
- the image skipping activation (false or true),
- and in case of image skipping activated, the mode for skipping images (scrolling or removing).
(the removing skipped images adds only three lines to the user code)
The full status of the image skipping feature is also visualized.

Results

From the requested FPS = 250 (by default), I get on my PC (fbc 32-bit/gas):
- for image skipping activation = false, applied FPS = about 50, CPU load = 0.8 %
- for image skipping activation = true and with scrolling skipped images, applied FPS = about 150, CPU load = 9.5 %
- for image skipping activation = true and with removing skipped images, applied FPS = about 250, CPU load = 6.6 %
(maximum accessible applied FPS in this third configuration: about 300 at limit of N=20)

From requested FPS = 250 (by default), I get on my PC (fbc 64-bit/gcc):
- for image skipping activation = false, applied FPS = about 50, CPU load = 0.4 %
- for image skipping activation = true and with scrolling skipped images, applied FPS = about 150, CPU load = 10.2 %
- for image skipping activation = true and with removing skipped images, applied FPS = about 250, CPU load = 5.2 %
(maximum accessible applied FPS in this third configuration: about 350 at limit of N=20)

Code

Test15:

Code: Select all

'' Graphic animation from dodicat (https://www.freebasic.net/forum/viewtopic.php?p=191032#p191032)

#include "regulateLite.bi"  '' defined in https://www.freebasic.net/forum/viewtopic.php?p=299929#p299929

'--------------------------------------------------------------------
union V3 field =1
    As double a(1 to 4)
    Declare Function rotate(Byref As V3,Byref As V3,Byref As V3) As V3
    Declare Function apply_perspective(Byref As V3) As V3
    declare function distance(Byref as V3) as double
End union
'---------------------------------------------------------------------
Function V3.rotate(Byref c As V3,Byref angle As V3,Byref scale As V3=Type<V3>({1,1,1})) As V3
    Dim As double sx=Sin(angle.a(1)),sy=Sin(angle.a(2)),sz=Sin(angle.a(3))
    Dim As double cx=Cos(angle.a(1)),cy=Cos(angle.a(2)),cz=Cos(angle.a(3))
    Dim As double dx=this.a(1)-c.a(1),dy=this.a(2)-c.a(2),dz=this.a(3)-c.a(3)
    Return Type<V3>({(scale.a(1))*((cy*cz)*dx+(-cx*sz+sx*sy*cz)*dy+(sx*sz+cx*sy*cz)*dz)+c.a(1),_
    (scale.a(2))*((cy*sz)*dx+(cx*cz+sx*sy*sz)*dy+(-sx*cz+cx*sy*sz)*dz)+c.a(2),_
    (scale.a(3))*((-sy)*dx+(sx*cy)*dy+(cx*cy)*dz)+c.a(3),this.a(4)})
End Function
'-----------------------------------------------------------------------
Function V3.apply_perspective(Byref eyepoint As V3) As V3
    Dim As double   w=1+(this.a(3)/eyepoint.a(3))
    Return Type<V3>({(this.a(1)-eyepoint.a(1))/w+eyepoint.a(1),(this.a(2)-eyepoint.a(2))/w+eyepoint.a(2),(this.a(3)-eyepoint.a(3))/w+eyepoint.a(3),this.a(4)})
End Function
'---------------------------------------------------------------------
function V3.distance(Byref V2 as V3) as double
  Return Sqr((This.a(1)-v2.a(1))*(This.a(1)-v2.a(1))+(This.a(2)-v2.a(2))*(This.a(2)-v2.a(2))+(This.a(3)-v2.a(3))*(This.a(3)-v2.a(3)))   
end function
'------------------------------------------------------------------------
Sub QuickSort(array() As V3,Byval begin As Integer,Byval Finish As integer)
    Dim As Integer i=begin,j=finish 
    Dim As V3 x =array(((I+J)\2))
    While  I <= J
        While array(I).a(3) > X.a(3):I+=1:Wend
        While array(J).a(3) < X.a(3):J-=1:Wend
        If I<=J Then Swap array(I),array(J): I+=1:J-=1
    Wend
    If J > begin Then QuickSort(array(),begin,J)
    If I < Finish Then QuickSort(array(),I,Finish)
End Sub
'=================================================================      

#define map(a,b,x,c,d) ((d)-(c))*((x)-(a))\((b)-(a))+(c)
'SET UP
Dim As Integer num=4000
Dim As Long fps=250,rfps
Dim As Boolean skipping=False,remove=False,skipped
Dim As Long ist,mist
Dim As Ulong averageFps
Dim As Double sumFps
Dim As Long N
Redim As V3 a(1 To num),r(1 To num)
For n As Integer=1 To num
    With a(n)
        .a(1)=400+150*cos(n):.a(2)=300+150*sin(n): .a(3)=150*sin(1.2*n)
        var d=a(n).distance(Type<V3>({500,100,0}))
        .a(4)=Rgb(255-d/5,255-d/2,d/3)
    End With
Next n
        
Screenres 800, 640, 32
Width 800 \ 8, 640 \ 16
color ,rgb(200,200,200)
'centre of rotation and perspective eyepoint
Dim As V3 ang,centre=Type<V3>({400,300,0}),eye=Type<V3>({400,300,500})
Do
    ang=Type<V3>({ang.a(1)+.01,ang.a(2)+.005,ang.a(3)+.0025})
    For n As Integer=Lbound(a) To Ubound(a)
        r(n)=a(n).rotate(centre,ang,Type<V3>({1,1,1}))
        r(n)=r(n).apply_perspective(eye)
    Next n
    QuickSort(r(),Lbound(r),Ubound(r))
    If (remove = False) Or (skipped = False) Then
        Screenlock
        Cls
        For n As Integer=Lbound(r) To Ubound(r)
            var rad=map(-150,150,r(n).a(3),15,10)
            Circle(r(n).a(1),r(n).a(2)),rad,r(n).a(4),,,,f
        Next n
        Draw String (16,16),"Requested FPS = " & Right("  " & fps, 3), 0
        Draw String (16,32),"Applied FPS   = " & Right("  " & rfps, 3) & "   (average = " & Right("  " & averageFps, 3) & ")", 0
        Draw String (16,48),"Status : " & _
            iif(skipping = True, "Image skipping activation = true, with " & _
            iif(remove = True, "removing images skipped = " & Iif(mist > 0, str(mist) & "/" & str(mist + 1), "0"), _
            "scrolling images skipped = " & Iif(mist > 0, str(mist) & "/" & str(mist + 1), "0")), _
            "Image skipping activation = false"), 0
        Draw String (16,80),"<+> : Increase FPS", 0
        Draw String (16,96),"<-> : Decrease FPS", 0
        Draw String (16,128),"<t> or <T> : True for image skipping activation", 0
        If Skipping = True Then
            Draw String (16,144),"   <s> or <S> : Scroll image skipped", 0
            Draw String (16,160),"   <r> or <R> : Remove image skipped", 0
            Draw String (16,176),"<f> or <F> : False for image skipping activation", 0
            Draw String (16,208),"<escape> : Quit", 0
        Else
            Draw String (16,144),"<f> or <F> : False for image skipping activation", 0
            Draw String (16,176),"<escape> : Quit", 0
        End If
        Draw String (544,608),"Graphic animation from dodicat", 0
        Screenunlock
    End If
    rfps = regulateLite(fps,skipping, ,skipped)
    If skipped = True Then
        ist += 1
    Else
        mist = ist
        ist = 0
    End If
    sumFps += rfps
    N += 1
    If N >= rfps / 2 Then
        averageFps = sumFps / N
        N = 0
        sumFps = 0
    End If
    Dim As String s = Ucase(Inkey)
    Select Case s
    Case "+"
        If fps < 500 Then fps += 1
    Case "-"
        If fps > 10 Then fps -= 1
    Case "T"
        skipping = True
    Case "F"
        skipping = False
    Case "S"
        If skipping = True Then remove = False
    Case "R"
        If skipping = True Then remove = True
    Case Chr(27)
        Exit do
    End Select
Loop
fxm
Moderator
Posts: 12133
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: "Lite regulation" function ('regulateLite()') to be integrated into user loop for FPS control

Post by fxm »

A twelfth graphic animation highlighting the interest of the image skipping feature of 'regulateLite()',
with scrolling and above all removing of skipped images


The graphic animation (heavy CPU load) comes from dodicat : Little rocking wave morpher.
Some initializations and code lines may have been modified from the author's original in order to better highlight the regulation with 'regulateLite()' and its different configurations of use.

This test code allows to modify:
- the value of the requested FPS (and it visualizes the applied FPS),
- the image skipping activation (false or true),
- and in case of image skipping activated, the mode for skipping images (scrolling or removing).
(the removing skipped images adds only three lines to the user code)
The full status of the image skipping feature is also visualized.

Results

From the requested FPS = 80 (by default), I get on my PC (fbc 32-bit/gas):
- for image skipping activation = false, applied FPS = about 23, CPU load = 5.0 %
- for image skipping activation = true and with scrolling skipped images, applied FPS = about 35, CPU load = 9.6 %
- for image skipping activation = true and with removing skipped images, applied FPS = about 80, CPU load = 3.6 %
(maximum accessible applied FPS in this third configuration: about 450 but too jerky, at limit of N=20)

From requested FPS = 80 (by default), I get on my PC (fbc 64-bit/gcc):
- for image skipping activation = false, applied FPS = about 20, CPU load = 6.3 %
- for image skipping activation = true and with scrolling skipped images, applied FPS = about 30, CPU load = 10.1 %
- for image skipping activation = true and with removing skipped images, applied FPS = about 80, CPU load = 4.8 %
(maximum accessible applied FPS in this third configuration: about 400 but too jerky, at limit of N=20)

Code

Test16:

Code: Select all

'' Graphic animation from dodicat (https://www.freebasic.net/forum/viewtopic.php?p=195122#p195122)

#include "regulateLite.bi"  '' defined in https://www.freebasic.net/forum/viewtopic.php?p=299929#p299929

Sub Thing(Byval w As Integer=700, _
    Byval h As Integer=600, _
    Byval posx As Integer=400, _
    Byval posy As Integer=300, _
    Byval morph as single=24, _
    Byval aspect as single=3, _
    Byval grade as single=6, _
    Byval col as uinteger=rgba(255,255,255,0))
          
    Dim As Single XStep = 1
    Dim As Single YStep = 1
    Dim As Single b=w*w
    Dim As Single y,m,n
    For x As Single = 0 To w Step XStep
        dim as single s=x*x
        dim as single p=Sqr(b-s)
        For i As Single = -P To P Step grade*YStep
            dim as single r = Sqr(s+i*i)/w
            dim as single Q = (R - 1) * Sin(morph*r)
            y=i/aspect+q*h
            If i = -p Then m=y:n=y
            If y > m Then m = y
            If y < n Then n = y
            If m=y Orelse n=y Then
                Pset(x/2+posx,-Y/2+posy),col/i 
                Pset(-x/2+posx,-Y/2+posy),col/i
            End If
        Next
    Next
End Sub

'===========================================================

Screenres 800, 640, 32, 2
Width 800 \ 8, 640 \ 16
color,rgb(0,0,50)
screenset 1,0

Dim As single Morph=0,k=1
dim as single aspect,counter,pi2=8*atn(1)
Dim As Long fps=80,rfps
Dim As Boolean skipping=False,remove=False,skipped
Dim As Long ist,mist
Dim As Ulong averageFps
Dim As Double sumFps
Dim As Long N

Do
    counter+=.1
    if counter>=pi2 then counter=0
    aspect=3+sin(counter)
    Morph+=.1*k
    If Morph>35 Then k=-k
    If Morph<-35 Then k=-k
    If (remove = False) Or (skipped = False) Then
        Cls
        Thing(800,500,400,300,Morph,aspect) 
        Draw String (16,16),"Requested FPS = " & Right("  " & fps, 3)
        Draw String (16,32),"Applied FPS   = " & Right("  " & rfps, 3) & "   (average = " & Right("  " & averageFps, 3) & ")"
        Draw String (16,48),"Status : " & _
            iif(skipping = True, "Image skipping activation = true, with " & _
            iif(remove = True, "removing images skipped = " & Iif(mist > 0, str(mist) & "/" & str(mist + 1), "0"), _
            "scrolling images skipped = " & Iif(mist > 0, str(mist) & "/" & str(mist + 1), "0")), _
            "Image skipping activation = false")
        Draw String (16,80),"<+> : Increase FPS"
        Draw String (16,96),"<-> : Decrease FPS"
        Draw String (16,128),"<t> or <T> : True for image skipping activation"
        If Skipping = True Then
            Draw String (16,144),"   <s> or <S> : Scroll image skipped"
            Draw String (16,160),"   <r> or <R> : Remove image skipped"
            Draw String (16,176),"<f> or <F> : False for image skipping activation"
            Draw String (16,208),"<escape> : Quit"
        Else
            Draw String (16,144),"<f> or <F> : False for image skipping activation"
            Draw String (16,176),"<escape> : Quit"
        End If
        Draw String (544,608),"Graphic animation from dodicat"
        flip
    End If
    rfps = regulateLite(fps,skipping, ,skipped)
    If skipped = True Then
        ist += 1
    Else
        mist = ist
        ist = 0
    End If
    sumFps += rfps
    N += 1
    If N >= rfps / 2 Then
        averageFps = sumFps / N
        N = 0
        sumFps = 0
    End If
    Dim As String s = Ucase(Inkey)
    Select Case s
    Case "+"
        If fps < 600 Then fps += 1
    Case "-"
        If fps > 10 Then fps -= 1
    Case "T"
        skipping = True
    Case "F"
        skipping = False
    Case "S"
        If skipping = True Then remove = False
    Case "R"
        If skipping = True Then remove = True
    Case Chr(27)
        Exit do
    End Select
Loop
fxm
Moderator
Posts: 12133
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: "Lite regulation" function ('regulateLite()') to be integrated into user loop for FPS control

Post by fxm »

A thirteenth graphic animation highlighting the interest of the image skipping feature of 'regulateLite()',
with scrolling and above all removing of skipped images


The graphic animation (heavy CPU load) comes from dodicat : Slab.
Some initializations and code lines may have been modified from the author's original in order to better highlight the regulation with 'regulateLite()' and its different configurations of use.

This test code allows to modify:
- the value of the requested FPS (and it visualizes the applied FPS),
- the image skipping activation (false or true),
- and in case of image skipping activated, the mode for skipping images (scrolling or removing).
(the removing skipped images adds only three lines to the user code)
The full status of the image skipping feature is also visualized.

Results

From the requested FPS = 200 (by default), I get on my PC (fbc 32-bit/gas):
- for image skipping activation = false, applied FPS = about 22, CPU load = 4.4 %
- for image skipping activation = true and with scrolling skipped images, applied FPS = about 40, CPU load = 9.6 %
- for image skipping activation = true and with removing skipped images, applied FPS = about 200, CPU load = 3.6 %
(maximum accessible applied FPS in this third configuration: about 500 at limit of N=20)

From requested FPS = 200 (by default), I get on my PC (fbc 64-bit/gcc):
- for image skipping activation = false, applied FPS = about 27, CPU load = 4.0 %
- for image skipping activation = true and with scrolling skipped images, applied FPS = about 60, CPU load = 9.4 %
- for image skipping activation = true and with removing skipped images, applied FPS = about 200, CPU load = 3.1 %
(maximum accessible applied FPS in this third configuration: about 550 at limit of N=20)

Code

Test17:

Code: Select all

'' Graphic animation from dodicat (https://www.freebasic.net/forum/viewtopic.php?p=165396#p165396)

#include "regulateLite.bi"  '' defined in https://www.freebasic.net/forum/viewtopic.php?p=299929#p299929

'SLAB
Dim Shared As Integer xres,yres
Screenres 800, 640, 32
Width 800 \ 8, 640 \ 16
Screeninfo xres,yres

Type vector3d
    As Single x,y,z
End Type
#define vct type<vector3d>

Dim Shared As vector3d eyepoint
Dim Shared Rx(1 To 3,1 To 3) As Single
Dim Shared Ry(1 To 3,1 To 3) As Single
Dim Shared Rz(1 To 3,1 To 3) As Single
Dim Shared pivot_vector(1 To 3) As Single
Dim Shared new_pos(1 To 3) As Single
Dim Shared temp1(1 To 3) As Single
Dim Shared temp2(1 To 3) As Single

Operator + (Byref v1 As vector3d,Byref v2 As vector3d) As vector3d
Return Type<vector3d>(v1.x+v2.x,v1.y+v2.y,v1.z+v2.z)
End Operator

Operator -(Byref v1 As vector3d,Byref v2 As vector3d) As vector3d
Return Type<vector3d>(v1.x-v2.x,v1.y-v2.y,v1.z-v2.z)
End Operator

Operator * (Byval f As Single,Byref v1 As vector3d) As vector3d
Return Type<vector3d>(f*v1.x,f*v1.y,f*v1.z)
End Operator

Function r(Byval first As Double, Byval last As Double) As Double
    Function = Rnd * (last - first) + first
End Function

Function apply_perspective(Byref p As vector3d) As vector3d
    Dim As Single   w=(p.z*(-1)/300+1)*.75
    Return vct((p.x-eyepoint.x)/w+eyepoint.x,(p.y-eyepoint.y)/w+eyepoint.y,(p.z-eyepoint.z)/w+eyepoint.z)
End Function

Function rotatepoint3d(Byref pivot As vector3d,_  
    Byref pt As vector3d,_  
    Byref angle As vector3d,_ 
    Byval dilator As Single=1) As vector3d 
    
    #macro mv(m1,v,ans)
    For i As Integer=1 To 3
        s=0
        For k As Integer = 1 To 3
            s=s+m1(i,k)*v(k)
        Next k
        ans(i)=s
    Next i
    #endmacro
    
    #define cr 0.0174532925199433
    
    Dim angle_radians As vector3d=Type<vector3d>(cr*angle.x,cr*angle.y,cr*angle.z)
    
    Dim s As Single=Any
    pivot_vector(1)=(pt.x-pivot.x)*dilator
    pivot_vector(2)=(pt.y-pivot.y)*dilator
    pivot_vector(3)=(pt.z-pivot.z)*dilator
    
    'rotat1on matrices about the three axix
    Rx(1,1)=1:Rx(1,2)=0:Rx(1,3)=0
    Rx(2,1)=0:Rx(2,2)=Cos(angle_radians.x):Rx(2,3)=-Sin(angle_radians.x)
    Rx(3,1)=0:Rx(3,2)=Sin(angle_radians.x):Rx(3,3)=Cos(angle_radians.x)
    
    Ry(1,1)=Cos(angle_radians.y):Ry(1,2)=0:Ry(1,3)=Sin(angle_radians.y)
    Ry(2,1)=0:Ry(2,2)=1:Ry(2,3)=0
    Ry(3,1)=-Sin(angle_radians.y):Ry(3,2)=0:Ry(3,3)=Cos(angle_radians.y)
    
    Rz(1,1)=Cos(angle_radians.z):Rz(1,2)=-Sin(angle_radians.z):Rz(1,3)=0
    Rz(2,1)=Sin(angle_radians.z):Rz(2,2)=Cos(angle_radians.z):Rz(2,3)=0
    Rz(3,1)=0:Rz(3,2)=0:Rz(3,3)=1
    
    mv (Rx,pivot_vector,temp1)           
    mv (Ry,temp1,temp2)
    mv (Rz,temp2,new_pos)
    
    new_pos(1)=new_pos(1)+pivot.x
    new_pos(2)=new_pos(2)+pivot.y
    new_pos(3)=new_pos(3)+pivot.z
    
    Return Type<vector3d>(new_pos(1),new_pos(2),new_pos(3))
End Function

Sub blow(a() As vector3d,Byval mag As Single)
    For z As Integer=1 To Ubound(a)
        a(z)=mag*a(z)
    Next z
End Sub

Sub translate(a() As vector3d,Byref pt As vector3d)
    For z As Integer=1 To Ubound(a)
        a(z)=a(z)+vct(pt.x,pt.y,pt.z)
    Next z
End Sub


Sub texture2(Byref piv As vector3d,Byref p1 As vector3d,Byref ang As vector3d,Byval dil As Single,Byval col As Uinteger)
    var _temp1=rotatepoint3d(piv,p1,ang,dil)
    _temp1=apply_perspective(_temp1)
    Circle(_temp1.x,_temp1.y),2+_temp1.z/50,col,,,,f
End Sub

Sub set_perspective(Byval x As Single,Byval y As Single,Byval z As Single,Byval minz As Single,Byval maxz As Single)
    'minz,maxz to do
    eyepoint=vct(x,y,z)
End Sub

Dim As Integer n=20000
Redim  As vector3d e(1 To n) 

Dim As Uinteger col(n)
For z As Integer=1 To n
    e(z)=vct(r(-2,2),r(-1,1),r(0,1))
    col(z)=Rgb(r(0,255),r(0,255),r(0,255))
Next z

blow(e(),100)
translate(e(),vct(xres/2,yres/2,0))
set_perspective(xres/2,yres/2,0,-100,100)

Dim As Single dilation=.2,dk=1
Dim As vector3d piv,ang
piv=eyepoint
Dim As Long fps=200,rfps
Dim As Boolean skipping=False,remove=False,skipped
Dim As Long ist,mist
Dim As Ulong averageFps
Dim As Double sumFps
Dim As Long N0

Do
    dilation=dilation+dk*.001
    
    If dilation>1 Then dk=-dk
    If dilation<.1 Then dk=-dk
    
    ang=vct(ang.x+.71,ang.y+.901,0)
    If ang.y>=360 Then ang.y=0
    If ang.y>=360 Then ang.y=0
    
    If (remove = False) Or (skipped = False) Then
        Screenlock
        Cls
        For z As Integer=1 To Ubound(e)
            texture2(piv,e(z),ang,dilation,col(z))
        Next z
        Draw String (16,16),"Requested FPS = " & Right("  " & fps, 3)
        Draw String (16,32),"Applied FPS   = " & Right("  " & rfps, 3) & "   (average = " & Right("  " & averageFps, 3) & ")"
        Draw String (16,48),"Status : " & _
            iif(skipping = True, "Image skipping activation = true, with " & _
            iif(remove = True, "removing images skipped = " & Iif(mist > 0, str(mist) & "/" & str(mist + 1), "0"), _
            "scrolling images skipped = " & Iif(mist > 0, str(mist) & "/" & str(mist + 1), "0")), _
            "Image skipping activation = false")
        Draw String (16,80),"<+> : Increase FPS"
        Draw String (16,96),"<-> : Decrease FPS"
        Draw String (16,128),"<t> or <T> : True for image skipping activation"
        If Skipping = True Then
            Draw String (16,144),"   <s> or <S> : Scroll image skipped"
            Draw String (16,160),"   <r> or <R> : Remove image skipped"
            Draw String (16,176),"<f> or <F> : False for image skipping activation"
            Draw String (16,208),"<escape> : Quit"
        Else
            Draw String (16,144),"<f> or <F> : False for image skipping activation"
            Draw String (16,176),"<escape> : Quit"
        End If
        Draw String (544,608),"Graphic animation from dodicat"
    Screenunlock
    End If
    rfps = regulateLite(fps,skipping, ,skipped)
    If skipped = True Then
        ist += 1
    Else
        mist = ist
        ist = 0
    End If
    sumFps += rfps
    N0 += 1
    If N0 >= rfps / 2 Then
        averageFps = sumFps / N0
        N0 = 0
        sumFps = 0
    End If
    Dim As String s = Ucase(Inkey)
    Select Case s
    Case "+"
        If fps < 600 Then fps += 1
    Case "-"
        If fps > 10 Then fps -= 1
    Case "T"
        skipping = True
    Case "F"
        skipping = False
    Case "S"
        If skipping = True Then remove = False
    Case "R"
        If skipping = True Then remove = True
    Case Chr(27)
        Exit do
    End Select
Loop
fxm
Moderator
Posts: 12133
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: "Lite regulation" function ('regulateLite()') to be integrated into user loop for FPS control

Post by fxm »

A fourteenth graphic animation highlighting the interest of the image skipping feature of 'regulateLite()',
with scrolling and above all removing of skipped images


The graphic animation (heavy CPU load) comes from dodicat : Visual look at a sphere (last code).
Some initializations and code lines may have been modified from the author's original in order to better highlight the regulation with 'regulateLite()' and its different configurations of use.

This test code allows to modify:
- the value of the requested FPS (and it visualizes the applied FPS),
- the image skipping activation (false or true),
- and in case of image skipping activated, the mode for skipping images (scrolling or removing).
(the removing skipped images adds only three lines to the user code)
The full status of the image skipping feature is also visualized.

Results

From the requested FPS = 100 (by default), I get on my PC (fbc 32-bit/gas):
- for image skipping activation = false, applied FPS = about 18, CPU load = 6.7 %
- for image skipping activation = true and with scrolling skipped images, applied FPS = about 26, CPU load = 9.8 %
- for image skipping activation = true and with removing skipped images, applied FPS = about 100, CPU load = 5.2 %
(maximum accessible applied FPS in this third configuration: about 390 at limit of N=20)

From requested FPS = 100 (by default), I get on my PC (fbc 64-bit/gcc):
- for image skipping activation = false, applied FPS = about 24, CPU load = 4.9 %
- for image skipping activation = true and with scrolling skipped images, applied FPS = about 48, CPU load = 10.2 %
- for image skipping activation = true and with removing skipped images, applied FPS = about 100, CPU load = 4.0 %
(maximum accessible applied FPS in this third configuration: about 500 at limit of N=20)

Code

Test18:

Code: Select all

'' Graphic animation from dodicat (https://www.freebasic.net/forum/viewtopic.php?p=223608#p223608 - last code)

#include "regulateLite.bi"  '' defined in https://www.freebasic.net/forum/viewtopic.php?p=299929#p299929

Screenres 800, 640, 32
Width 800 \ 8, 640 \ 16
dim as integer xres,yres
screeninfo xres,yres
randomize ,2

type pt
    as single x,y,z
    as ulong c
    as long flag 'unused
    #define length(Pt) sqr(Pt.x^2+Pt.y^2+Pt.z^2)
    #define map(a,b,x,c,d) ((d)-(c))*((x)-(a))\((b)-(a))+(c)
end type

type Angle 'FLOATS for angles
    as single sx,sy,sz
    as single cx,cy,cz
    declare static function construct(byval as single,byval as single,byval as single) as Angle
end type

function Angle.construct(byval x as single,byval y as single,byval z as single) as Angle
    return    type <Angle>(sin(x),sin(y),sin(z), _
                           cos(x),cos(y),cos(z))
end function
   
Sub QuickSort(array() As pt,byval begin As Integer,byval Finish As Uinteger)
    Dim As long i=begin,j=finish 
    Dim As pt x =array(((I+J)\2))
    While  I <= J
        While array(I).z > X.z: I+=1:wend ' reversable <
        While array(J).z < X.z: J-=1:wend ' reversable >
        If I<=J Then Swap array(I),array(J): I+=1:J-=1
    Wend
    If J > begin Then QuickSort(array(),begin,J)
    If I < Finish Then QuickSort(array(),I,Finish)
End Sub

type point as pt

Function RotatePoint(byref c As Point,byref p As Point,byref a as Angle,byref scale As Angle=Type<Angle>(1,1,1)) As Point
    Dim As Single dx=p.x-c.x,dy=p.y-c.y,dz=p.z-c.z
    Return Type<Point>((scale.sx)*((a.cy*a.cz)*dx+(-a.cx*a.sz+a.sx*a.sy*a.cz)*dy+(a.sx*a.sz+a.cx*a.sy*a.cz)*dz)+c.x,_
    (scale.sy)*((a.cy*a.sz)*dx+(a.cx*a.cz+a.sx*a.sy*a.sz)*dy+(-a.sx*a.cz+a.cx*a.sy*a.sz)*dz)+c.y,_
    (scale.sz)*((-a.sy)*dx+(a.sx*a.cy)*dy+(a.cx*a.cy)*dz)+c.z,p.c,p.flag)
End Function 

Function perspective(byref p As Point,byref eyepoint As Point) As Point
    Dim As Single   w=1+(p.z/eyepoint.z)
    Return Type<Point>((p.x-eyepoint.x)/w+eyepoint.x,(p.y-eyepoint.y)/w+eyepoint.y,(p.z-eyepoint.z)/w+eyepoint.z,p.c,p.flag)
End Function

sub FillWithUnitVectors(a() as pt)
    dim as long X=ubound(a),lb=lbound(a)
    #macro subfill(L,U,d1,d2,d3)
    for n as long=L to U
        a(n).x= d1 rnd    
        a(n).y= d2 rnd*sqr(1-(a(n).x*a(n).x))
        a(n).z= d3 sqr((1-(a(n).x*a(n).x+a(n).y*a(n).y)))
        if n and 1 then swap a(n).x,a(n).z
    next n
    #endmacro
    subfill(lb,X/8,,,)
    subfill(X/8,2*X/8,-,,)
    subfill(2*X/8,3*X/8,-,-,)
    subfill(3*X/8,4*X/8,,-,)
    subfill(4*X/8,5*X/8,,,-)
    subfill(5*X/8,6*X/8,-,,-)
    subfill(6*X/8,7*X/8,-,-,-)
    subfill(7*X/8,X,,-,-)
end sub
 
redim as pt Q(1 to 30000):randomize ,2   
redim as pt rot(lbound(q) to ubound(q))

FillWithUnitVectors(q())
'set colours in q()
for n as long=1 to ubound(q)
    q(n).c=rgb(rnd*255,rnd*255,rnd*255)
next

#macro drawpoints(q)
for n as long=1 to ubound(q)
    var rad=map(-1,1,q(n).z,3,1)
    circle(xres/2+.3*xres*q(n).x,yres/2+.3*xres*q(n).y),rad,q(n).c,,,,f
next
#endmacro

#macro rotate(angle)
for n as long=1 to ubound(q)
    rot(n)=rotatepoint(Type<pt>(0,0,0),q(n),angle)
    rot(n)=perspective(rot(n),type<pt>(0,0,3))
next
quicksort(rot(),lbound(rot),ubound(rot))
drawpoints(rot)
#endmacro

'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++   

dim as single da 
dim as string key
Dim As Long fps=100,rfps
Dim As Boolean skipping=False,remove=False,skipped
Dim As Long ist,mist
Dim As Ulong averageFps
Dim As Double sumFps
Dim As Long N

do
    da+=.005
    If (remove = False) Or (skipped = False) Then
        screenlock
        cls
        rotate( (Angle.construct(0,da,0)) )
        Draw String (16,16),"Requested FPS = " & Right("  " & fps, 3)
        Draw String (16,32),"Applied FPS   = " & Right("  " & rfps, 3) & "   (average = " & Right("  " & averageFps, 3) & ")"
        Draw String (16,48),"Status : " & _
            iif(skipping = True, "Image skipping activation = true, with " & _
            iif(remove = True, "removing images skipped = " & Iif(mist > 0, str(mist) & "/" & str(mist + 1), "0"), _
            "scrolling images skipped = " & Iif(mist > 0, str(mist) & "/" & str(mist + 1), "0")), _
            "Image skipping activation = false")
        Draw String (16,80),"<+> : Increase FPS"
        Draw String (16,96),"<-> : Decrease FPS"
        Draw String (16,128),"<t> or <T> : True for image skipping activation"
        If Skipping = True Then
            Draw String (16,144),"   <s> or <S> : Scroll image skipped"
            Draw String (16,160),"   <r> or <R> : Remove image skipped"
            Draw String (16,176),"<f> or <F> : False for image skipping activation"
            Draw String (16,208),"<escape> : Quit"
        Else
            Draw String (16,144),"<f> or <F> : False for image skipping activation"
            Draw String (16,176),"<escape> : Quit"
        End If
        Draw String (544,608),"Graphic animation from dodicat"
        screenunlock
    End If
    rfps = regulateLite(fps,skipping, ,skipped)
    If skipped = True Then
        ist += 1
    Else
        mist = ist
        ist = 0
    End If
    sumFps += rfps
    N += 1
    If N >= rfps / 2 Then
        averageFps = sumFps / N
        N = 0
        sumFps = 0
    End If
    Dim As String s = Ucase(Inkey)
    Select Case s
    Case "+"
        If fps < 600 Then fps += 1
    Case "-"
        If fps > 10 Then fps -= 1
    Case "T"
        skipping = True
    Case "F"
        skipping = False
    Case "S"
        If skipping = True Then remove = False
    Case "R"
        If skipping = True Then remove = True
    Case Chr(27)
        Exit do
    End Select
loop
fxm
Moderator
Posts: 12133
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: "Lite regulation" function ('regulateLite()') to be integrated into user loop for FPS control

Post by fxm »

A fifteenth graphic animation highlighting the interest of the image skipping feature of 'regulateLite()',
with scrolling and above all removing of skipped images


The graphic animation (heavy CPU load) comes from dodicat : Here.
Some initializations and code lines may have been modified from the author's original in order to better highlight the regulation with 'regulateLite()' and its different configurations of use.

This test code allows to modify:
- the value of the requested FPS (and it visualizes the applied FPS),
- the image skipping activation (false or true),
- and in case of image skipping activated, the mode for skipping images (scrolling or removing).
(the removing skipped images adds only three lines to the user code)
The full status of the image skipping feature is also visualized.

Results

From the requested FPS = 100 (by default), I get on my PC (fbc 32-bit/gas):
- for image skipping activation = false, applied FPS = about 23, CPU load = 4.5 %
- for image skipping activation = true and with scrolling skipped images, applied FPS = about 49, CPU load = 9.9 %
- for image skipping activation = true and with removing skipped images, applied FPS = about 100, CPU load = 3.4 %
(maximum accessible applied FPS in this third configuration: about 500 at limit of N=20)

From requested FPS = 100 (by default), I get on my PC (fbc 64-bit/gcc):
- for image skipping activation = false, applied FPS = about 17, CPU load = 7.0 %
- for image skipping activation = true and with scrolling skipped images, applied FPS = about 24, CPU load = 9.8 %
- for image skipping activation = true and with removing skipped images, applied FPS = about 100, CPU load = 5.5 %
(maximum accessible applied FPS in this third configuration: about 320 at limit of N=20)

Code

Test19:

Code: Select all

'' Graphic animation from dodicat (https://www.freebasic.net/forum/viewtopic.php?p=166803#p166803)

#include "regulateLite.bi"  '' defined in https://www.freebasic.net/forum/viewtopic.php?p=299929#p299929

'THE THING
Dim Shared As Integer xres,yres
Screenres 800, 640, 32
Width 800 \ 8, 640 \ 16
Screeninfo xres,yres

Type vector3d
    As Single x,y,z
End Type
#define vct type<vector3d>

Dim Shared As vector3d eyepoint
Dim Shared Rx(1 To 3,1 To 3) As Single
Dim Shared Ry(1 To 3,1 To 3) As Single
Dim Shared Rz(1 To 3,1 To 3) As Single
Dim Shared pivot_vector(1 To 3) As Single
Dim Shared new_pos(1 To 3) As Single
Dim Shared temp1(1 To 3) As Single
Dim Shared temp2(1 To 3) As Single

Operator + (Byref v1 As vector3d,Byref v2 As vector3d) As vector3d
    Return Type<vector3d>(v1.x+v2.x,v1.y+v2.y,v1.z+v2.z)
End Operator

Operator -(Byref v1 As vector3d,Byref v2 As vector3d) As vector3d
    Return Type<vector3d>(v1.x-v2.x,v1.y-v2.y,v1.z-v2.z)
End Operator

Operator * (Byval f As Single,Byref v1 As vector3d) As vector3d
    Return Type<vector3d>(f*v1.x,f*v1.y,f*v1.z)
End Operator

Function r(Byval first As Double, Byval last As Double) As Double
    Function = Rnd * (last - first) + first
End Function

Function apply_perspective(Byref p As vector3d) As vector3d
    Dim As Single   w=(p.z*(-1)/300+1)*.75
    Return vct((p.x-eyepoint.x)/w+eyepoint.x,(p.y-eyepoint.y)/w+eyepoint.y,(p.z-eyepoint.z)/w+eyepoint.z)
End Function

Function rotatepoint3d(Byref pivot As vector3d,Byref pt As vector3d,Byref angle As vector3d,Byval dilator As Single=1) As vector3d  
    #macro mv(m1,v,ans)
    For i As Integer=1 To 3
        s=0
        For k As Integer = 1 To 3
            s=s+m1(i,k)*v(k)
        Next k
        ans(i)=s
    Next i
    #endmacro
    #define cr 0.0174532925199433
    Dim angle_radians As vector3d=Type<vector3d>(cr*angle.x,cr*angle.y,cr*angle.z)
    
    Dim s As Single=Any
    pivot_vector(1)=(pt.x-pivot.x)*dilator
    pivot_vector(2)=(pt.y-pivot.y)*dilator
    pivot_vector(3)=(pt.z-pivot.z)*dilator
    
    'rotat1on matrices about the three axix
    Rx(1,1)=1:Rx(1,2)=0:Rx(1,3)=0
    Rx(2,1)=0:Rx(2,2)=Cos(angle_radians.x):Rx(2,3)=-Sin(angle_radians.x)
    Rx(3,1)=0:Rx(3,2)=Sin(angle_radians.x):Rx(3,3)=Cos(angle_radians.x)
    
    Ry(1,1)=Cos(angle_radians.y):Ry(1,2)=0:Ry(1,3)=Sin(angle_radians.y)
    Ry(2,1)=0:Ry(2,2)=1:Ry(2,3)=0
    Ry(3,1)=-Sin(angle_radians.y):Ry(3,2)=0:Ry(3,3)=Cos(angle_radians.y)
    
    Rz(1,1)=Cos(angle_radians.z):Rz(1,2)=-Sin(angle_radians.z):Rz(1,3)=0
    Rz(2,1)=Sin(angle_radians.z):Rz(2,2)=Cos(angle_radians.z):Rz(2,3)=0
    Rz(3,1)=0:Rz(3,2)=0:Rz(3,3)=1
    
    mv (Rx,pivot_vector,temp1)           
    mv (Ry,temp1,temp2)
    mv (Rz,temp2,new_pos)
    
    new_pos(1)=new_pos(1)+pivot.x
    new_pos(2)=new_pos(2)+pivot.y
    new_pos(3)=new_pos(3)+pivot.z
    
    Return Type<vector3d>(new_pos(1),new_pos(2),new_pos(3))
End Function

Sub blow(a() As vector3d,Byval mag As Single)
    For z As Integer=1 To Ubound(a)
        a(z)=mag*a(z)
    Next z
End Sub

Sub translate(a() As vector3d,Byref pt As vector3d)
    For z As Integer=1 To Ubound(a)
        a(z)=a(z)+vct(pt.x,pt.y,pt.z)
    Next z
End Sub

Function vertex(Byref piv As vector3d,Byref p1 As vector3d,Byref ang As vector3d,Byval dil As Single,Byref col As Uinteger) As Single
    var _temp1=rotatepoint3d(piv,p1,ang,dil)
    _temp1=apply_perspective(_temp1)
    Circle(_temp1.x,_temp1.y),(20*Abs(dil)+Abs(_temp1.z/2)*1*dil),col,,,,f
    Return _temp1.z
End Function

Sub set_perspective(Byval x As Single,byval y As Single,Byval z As Single,Byval minz As Single,Byval maxz As Single)
    eyepoint=vct(x,y,z)
End Sub

#macro combsort(array,comp)
    Scope
        var size=Ubound(array),switch=0,j=0
        Dim As Single void=size
        Do
            void=void/1.3: If void<1 Then void=1
            switch=0
            For i As Integer =1 To size-void
                j=i+void
                If comp(i)>comp(j) Then 
                    Swap array(i),array(j): switch=1
                    Swap comp(i),comp(j)
                    Swap col(i),col(j)
                End If
            Next
        Loop Until  switch =0 And void=1
    End Scope
#endmacro

Redim Shared As vector3d e(0)
Dim count As Integer
Redim Shared As Uinteger col(0)
For x As Single=-1 To 1 Step .02
    For y As Single=-1 To 1 Step .02
        count=count+1
        Redim Preserve e(count)
        Redim Preserve col(count)
        col(count)=Rgb(155*(x+1)/2,155*(y+1)/2,Rnd*155)
        e(count)=Type<vector3d>(x,y,(Sin(5*x)+Cos(5*y))/5)
    Next y
Next x

blow(e(),800)
translate(e(),vct(xres/2,yres/2,0))
set_perspective(xres/2,yres/2,0,-100,100)

Dim As Single dilation=.2
Dim As vector3d piv,ang
piv=eyepoint

Dim As String i
Dim As Single zeds(Ubound(e)),_mw
Dim As Uinteger colour
Dim As Integer mx,my,mw
Dim As Single startdilation=.17
dilation=startdilation

Dim As Long fps=100,rfps
Dim As Boolean skipping=False,remove=False,skipped
Dim As Long ist,mist
Dim As Ulong averageFps
Dim As Double sumFps
Dim As Long N

Do
    ang.y=ang.y+.5
    ang.x=ang.x+.5
    ang.z=ang.z+.25
    If (remove = False) Or (skipped = False) Then
        Screenlock
        Cls
        Getmouse mx,my,mw
        _mw=mw/100
        combsort(e,zeds)
        dilation=startdilation+_mw
        For z As Integer=1 To Ubound(e)
            zeds(z)=vertex(piv,e(z),ang,dilation,col(z))
        Next z
        Draw String (16,16),"Requested FPS = " & Right("  " & fps, 3)
        Draw String (16,32),"Applied FPS   = " & Right("  " & rfps, 3) & "   (average = " & Right("  " & averageFps, 3) & ")"
        Draw String (16,48),"Status : " & _
            iif(skipping = True, "Image skipping activation = true, with " & _
            iif(remove = True, "removing images skipped = " & Iif(mist > 0, str(mist) & "/" & str(mist + 1), "0"), _
            "scrolling images skipped = " & Iif(mist > 0, str(mist) & "/" & str(mist + 1), "0")), _
            "Image skipping activation = false")
        Draw String (16,80),"<+> : Increase FPS"
        Draw String (16,96),"<-> : Decrease FPS"
        Draw String (16,128),"<t> or <T> : True for image skipping activation"
        If Skipping = True Then
            Draw String (16,144),"   <s> or <S> : Scroll image skipped"
            Draw String (16,160),"   <r> or <R> : Remove image skipped"
            Draw String (16,176),"<f> or <F> : False for image skipping activation"
            Draw String (16,208),"<escape> : Quit"
        Else
            Draw String (16,144),"<f> or <F> : False for image skipping activation"
            Draw String (16,176),"<escape> : Quit"
        End If
        Draw String (16,608),"<mouse wheel> : Dilatation/Compression"
        Draw String (544,608),"Graphic animation from dodicat"
        Screenunlock
    End If
    rfps = regulateLite(fps,skipping, ,skipped)
    If skipped = True Then
        ist += 1
    Else
        mist = ist
        ist = 0
    End If
    sumFps += rfps
    N += 1
    If N >= rfps / 2 Then
        averageFps = sumFps / N
        N = 0
        sumFps = 0
    End If
    Dim As String s = Ucase(Inkey)
    Select Case s
    Case "+"
        If fps < 600 Then fps += 1
    Case "-"
        If fps > 10 Then fps -= 1
    Case "T"
        skipping = True
    Case "F"
        skipping = False
    Case "S"
        If skipping = True Then remove = False
    Case "R"
        If skipping = True Then remove = True
    Case Chr(27)
        Exit do
    End Select
Loop
fxm
Moderator
Posts: 12133
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: "Lite regulation" function ('regulateLite()') to be integrated into user loop for FPS control

Post by fxm »

srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: "Lite regulation" function ('regulateLite()') to be integrated into user loop for FPS control

Post by srvaldez »

fxm, I think that it would be good to have it in the manual, this thread may get buried and hard to find
Arachnophilia
Posts: 26
Joined: Sep 04, 2015 13:33

Re: "Lite regulation" function ('regulateLite()') to be integrated into user loop for FPS control

Post by Arachnophilia »

fxm wrote: Feb 17, 2024 12:21 Would anyone wish me to copy the first post of this topic ('Lite regulation function to be integrated into user loop for FPS control') into the Programmer's Guide (under the 'Graphics' section) ?
Hello fxm
You are sharing some excellent work here, including the documentation. :!:
It would be a real shame if this got "lost" in the depths of the forum or the internet.
I would also like to see this guide and source code in the graphics section of the programming manual. :D
fxm
Moderator
Posts: 12133
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: "Lite regulation" function ('regulateLite()') to be integrated into user loop for FPS control

Post by fxm »

fxm wrote: Feb 17, 2024 12:21 Would anyone wish me to copy the first post of this topic ('Lite regulation function to be integrated into user loop for FPS control') into the Programmer's Guide (under the 'Graphics' section) ?

Done:
- ProPgLiteRegulate → fxm [new page 'Lite regulation function to be integrated into user loop for FPS control']
- CatPgProgrammer → fxm [added link to new page 'Lite regulation function to be integrated into user loop for FPS control']
- ProPgAntiFlickering → fxm [added link to new page 'Lite regulation function to be integrated into user loop for FPS control']
- ProPgDelayRegulate → fxm [added link to new page 'Lite regulation function to be integrated into user loop for FPS control']
- PrintToc → fxm [added link to new page 'Lite regulation function to be integrated into user loop for FPS control']
Post Reply