#include once "FBTinyGL.bi" const scr_w = 640 const scr_h = 480 const scr_b = 16 ' 8,16,24,32 screenres scr_w,scr_h,scr_b windowtitle "FPS test for software rendering [ESC]=quit" if scr_b=8 then color 224 var ctx = CreateRenderContext() dim as single rtri,rquad,timescale glViewport(0,0, scr_w, scr_h) glMatrixMode(GL_PROJECTION) glLoadIdentity() gluPerspective(45.0, scr_w/scr_h, 0.1, 100.0) glMatrixMode(GL_MODELVIEW) glTranslatef( 0, 0, -6) ' move the camera dim as integer frames,fps=500 dim as double tLast = timer() while inkey="" frames+=1 glClear(GL_COLOR_BUFFER_BIT) glPushMatrix() ' save camera matrix glTranslatef( -1.5, 0.0, 0.0) glRotatef( rtri, 0, 1, 0) glBegin(GL_TRIANGLES) glColor3f 1.0, 0.0, 0.0 : glVertex3f 0.0, 1.0, 0.0 glColor3f 0.0, 1.0, 0.0 : glVertex3f -1.0, -1.0, 0.0 glColor3f 0.0, 0.0, 1.0 : glVertex3f 1.0, -1.0, 0.0 glEnd() glPopMatrix() #if 1 glPushMatrix() glTranslatef 1.5, 0.0, 0.0 glColor3f 0.5, 0.5, 1.0 glRotatef rquad, 1, 0, 0 glBegin(GL_QUADS) glVertex3f -1.0, 1.0, 0.0 glVertex3f 1.0, 1.0, 0.0 glVertex3f 1.0, -1.0, 0.0 glVertex3f -1.0, -1.0, 0.0 glEnd() glPopMatrix() #endif timescale = iif(fps<>0,1.0f/fps,0) rtri += 80*timescale rquad += 120*timescale 'screensync ' <-- enable 60 Hz screenlock SwapBuffers(ctx) locate 1,1 : print " fps: " & fps screenunlock if frames mod 10=0 then dim as double tNow=timer() fps = 10/(tNow-tLast) tLast=tNow end if wend