I’m trying something along these lines:
private static class TexturePanel extends JPanel {
@Override
protected void paintComponent(Graphics graphics) {
// drawing code
// calc fps
repaint();
}
}
Is calling repaint() in paintComponent() the right approach to this?
A crude measure is to give the repaint
Timeran arbitrarily short delay & count FPS.No. No it isn’t.
paintComponent()is fine, but don’t triggerrepaint()from within the method. See the Performing Custom Painting Lesson of the Java Tutorial for some tips.If you cannot get it sorted from that, I suggest you prepare and post an SSCCE of your best effort.