Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Display timerexec delay limits
Display timerexec delay limits [message #452251] Tue, 15 March 2005 22:57
Asim Ullah is currently offline Asim UllahFriend
Messages: 24
Registered: July 2009
Junior Member
I'm trying to run some SWT OpenGL test programs
at high frames per seconds, but I keep running into a 64fps
speed limit.
I'm using timerexec with various small millisecond delays,
in the sub 30 ms range. The time slices is this range
tend to have a higher discrepancy to the specified delay values.

I've written a small example of my use of the timerexec below.
Perhaps there is a better way of doing this.

Has anyone run into anything similar?

I'm using SWT3.1M5a on WinXP pro Sp2, card:ATI X800XT @ 75Hz.

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;

public class TimerTest {
int framecount, fps;
long prevTime, currTime;
Shell shell;
Display display;
Canvas canvas;

public void run() {
display = new Display();
shell = new Shell(display);
shell.setSize(100, 100);
shell.setLayout(new FillLayout());
canvas = new Canvas(shell, SWT.NONE);
prevTime = System.currentTimeMillis();

canvas.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent event) {
event.gc.drawText(String.valueOf(fps), 10, 10);

new Runnable() {
public void run() {
if (canvas.isDisposed())

currTime = System.currentTimeMillis();
if ((currTime - prevTime) >= 1000) {
framecount = 0;
prevTime = System.currentTimeMillis();
// System.out.println(fps);
canvas.getDisplay().timerExec(9, this);

while (!shell.isDisposed()) {
if (!display.readAndDispatch())

public static void main(String[] args) {
new TimerTest().run();
Previous Topic:Setting a color of an OLE-Control
Next Topic:Why doesn't grab grab?
Goto Forum:

Current Time: Mon Mar 08 10:10:33 GMT 2021

Powered by FUDForum. Page generated in 0.02084 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top