Using direct pixels is very slow with 64 bit fbc.
I had noticed this before.
Code: Select all
#Include Once "GL/glu.bi"
Screenres 500,300,,,2
Sub GL2dsetup
dim as integer wx,wy
screeninfo wx,wy
glMatrixMode (GL_PROJECTION)
glLoadIdentity ()
glOrtho (0,wx, wy,0, -1, 1)
glMatrixMode (GL_MODELVIEW)
glDisable (GL_DEPTH_TEST)
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA)
glEnable (GL_BLEND)
glEnable (GL_LINE_SMOOTH)
glclearcolor 0,0,.2,1
glLineWidth(1)
End Sub
GL2dsetup
type colour
as ubyte r,g,b,a
end type
Function framecounter() As Integer
var t2=timer
Static As Double t3,frames,answer
frames=frames+1
If (t2-t3)>=1 Then
t3=t2
answer=frames
frames=0
End If
Return answer
End Function
Sub digits(t As String,x As long,y As long,clr As colour,sz As long)
glend
x=x-2*sz
dim as single s=any,c=any
#define nsz sz\20
#macro thickline(x1,y1,x2,y2)
glColor4ub(clr.r,clr.g,clr.b,clr.a)
s=(y1-y2)/10
c=(x2-x1)/10
glend: glbegin gl_quads
glvertex2f(x1+(s*-nsz),(y1+(c*-nsz)))
glvertex2f(x1+(s*nsz),(y1+(c*nsz)))
glvertex2f(x2+(s*nsz),(y2+(c*nsz)))
glvertex2f(x2+(s*-nsz),(y2+(c*-nsz)))
glend
#endmacro
#macro display(_a,_b,_c,_d,_e,_f,_g)
x=x+2*sz
If _a=1 Then :thickline(x,y,(x+sz),y):End If
If _b=1 Then :thickline((x+sz),y,(x+sz),(y+sz)):End If
If _c=1 Then :thickline((x+sz),(y+sz),(x+sz),(y+2*sz)):End If
If _d=1 Then :thickline((x+sz),(y+2*sz),x,(y+2*sz)):End If
If _e=1 Then :thickline(x,(y+2*sz),x,(y+sz)):End If
If _f=1 Then :thickline(x,(y+sz),x,y):End If
If _g=1 Then :thickline(x,(y+sz),(x+sz),(y+sz)):End If
#endmacro
For z As long=0 To Len(t)-1
Select Case As Const t[z]
Case 48 :display(1,1,1,1,1,1,0) '"0"
Case 49 :display(0,1,1,0,0,0,0) '"1"
Case 50 :display(1,1,0,1,1,0,1) '"2"
Case 51 :display(1,1,1,1,0,0,1) '"3"
Case 52 :display(0,1,1,0,0,1,1) '"4"
Case 53 :display(1,0,1,1,0,1,1) '"5"
Case 54 :display(1,0,1,1,1,1,1) '"6"
Case 55 :display(1,1,1,0,0,0,0) '"7"
Case 56 :display(1,1,1,1,1,1,1) '"8"
Case 57 :display(1,1,1,1,0,1,1) '"9"
Case 58 '":"
glpointsize sz/4
glbegin gl_points
glvertex3f ((x+2*sz),(y+sz/2),0)
glvertex3f ((x+2*sz),(y+1.5*sz),0)
glend
x=x+sz
Case 45 :display(0,0,0,0,0,0,1) '"-"
Case 46 '"."
glpointsize sz/4
glbegin gl_points
glvertex3f((x+2*sz),(y+1.9*sz),0)
glend
x=x+sz
Case 32 '" "
x=x+sz
End Select
Next z
glend
End Sub
windowtitle "FRAMERATE"
do
glClear (GL_COLOR_BUFFER_BIT)
digits(str(framecounter),100,100,type(200,100,0,255),25)
'sleep 1
Flip
Loop Until inkey=Chr(27)