Post Reply 
G2 screen refresh rate (20200121)
02-01-2020, 05:22 AM
Post: #27
RE: G2 screen refresh rate (20200121)
At the risk of causing an epileptic outbreak--I wrote a couple programs to explore the screen refresh. I started this before Cyrille gave us the details, but there is still some interesting behavior to be seen.

STROBE flashes a square on the screen at a given frequency.
STROBEH and STROBEV move a line and bar across or down the screen, stepping at the given frequency.

STROBE shows banding, so there must be something going on with the vertical refresh of the screen.

I think the faster refresh improves the looks of a couple graphics programs I've written, such as PENDULUMS2. Not worth burning battery most of the time, but cuts down on some afterimage blurring.

-jgs


STROBE
Code:

EXPORT STROBE()
BEGIN
LOCAL x,y,z,c;
LOCAL t,r,s,f,a;
INPUT(a,"Frequency","Frequency",
      "Desired frequency in hertz.",
      55,55);
RECT_P(#BBBBBB);
DIMGROB_P(G1,100,100,#0);
DIMGROB_P(G2,100,100,#FFFFFF);
f:=500/a;
c:=0;
r:=1;
t:=TICKS();
s:=t+f;
WHILE GETKEY==−1 DO
BLIT_P(60,60,IFTE(r,G1,G2));
r:=NOT(r);
c:=c+1;
WHILE TICKS()<s DO
END;
s:=s+f;
END;
r:=TICKS();
//RECT_P(#FFFFFF);
TEXTOUT_P(500*c/(r-t),65,10);
FREEZE;
END;

STROBEH
Code:

EXPORT STROBEH()
BEGIN
LOCAL x,y,z,c;
LOCAL t,r,s,f,a;
INPUT(a,"Frequency","Frequency",
      "Desired frequency in hertz.",
      55,55);
RECT_P(#FFFFFF);
f:=1000/a;
x:=0;
z:=0;
y:=319;
c:=0;
t:=TICKS();
s:=t+f;
WHILE GETKEY==−1 DO
LINE_P(y,40,y,60,#FFFFFF);
LINE_P(x,40,x,50,#0);
LINE_P(z,51,z,60,#0);
y:=x;
x:=((x+1) MOD 320);
z:=((z+.5) MOD 320);
c:=c+1;
WHILE TICKS()<s DO
END;
s:=s+f;
END;
r:=TICKS();
TEXTOUT_P(1000*c/(r-t),65,10);
FREEZE;
END;

STROBEV
Code:

EXPORT STROBEV()
BEGIN
LOCAL x,y,z,c;
LOCAL t,r,s,f,a;
INPUT(a,"Frequency","Frequency",
      "Desired frequency in hertz.",
      55,55);
RECT_P(#FFFFFF);
f:=1000/a;
x:=0;
z:=0;
y:=239;
c:=0;
t:=TICKS();
s:=t+f;
WHILE GETKEY==−1 DO
LINE_P(40,y,60,y,#FFFFFF);
LINE_P(40,x,50,x,#0);
LINE_P(51,z,60,z,#0);
y:=x;
x:=((x+1) MOD 240);
z:=((z+.5) MOD 240);
c:=c+1;
WHILE TICKS()<s DO
END;
s:=s+f;
END;
r:=TICKS();
TEXTOUT_P(1000*c/(r-t),65,10);
FREEZE;
END;

PENDULUMS2
Code:

EXPORT PENDULUMS2()
BEGIN
DIMGROB_P(G1,320,240);
DIMGROB_P(G2,440,25,RGB(255,255,255,255));

// SET UP SPRITES
FOR B FROM 0 TO 19 DO
ARC_P(G2,11+B*22,11,10,
    {#0,RGB(255-B*12,64,B*12)});
ARC_P(G2,14+B*22,14,4,
    {RGB(255-B*12,64,B*12),RGB(MIN(295-B*12,255),104,MIN(B*12,255))});
END;



FOR T FROM 0 TO 1000 STEP .01 DO

RECT_P(G1,RGB(192,192,192));
TEXTOUT_P(T,G1,10,10);

FOR B FROM 0 TO 19 DO
//C:=RGB(255-B*12,64,B*12,64);
//ARC_P(G1,160+150*SIN(T*(1-B/80)),12+B*11,10,{#0,C});
BLIT_P(G1,150+150*SIN(T*(1-B/80)),2+B*11,G2,1+B*22,1,22+B*22,22);
END;

BLIT(G1);

END;



END;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: G2 screen refresh rate (20200121) - john gustaf stebbins - 02-01-2020 05:22 AM



User(s) browsing this thread: 1 Guest(s)