Skip to content

fix LWJGL3 Canvas Frame Rate - #2927

Draft
riccardobl wants to merge 1 commit into
jMonkeyEngine:masterfrom
riccardobl:fix/frame-rate-in-canvas
Draft

fix LWJGL3 Canvas Frame Rate#2927
riccardobl wants to merge 1 commit into
jMonkeyEngine:masterfrom
riccardobl:fix/frame-rate-in-canvas

Conversation

@riccardobl

Copy link
Copy Markdown
Member

No description provided.

@riccardobl
riccardobl force-pushed the fix/frame-rate-in-canvas branch from 5c757a4 to 9aeff56 Compare August 4, 2026 14:28
Co-authored-by: gpt-5.6-sol <noreply@openai.com>
Co-authored-by: gpt-5.6-luna <noreply@openai.com>
@riccardobl
riccardobl force-pushed the fix/frame-rate-in-canvas branch from 9aeff56 to 7066920 Compare August 4, 2026 14:31

@JNightRider JNightRider left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this PR needs a bit more work and cleanup... I haven't tested it, as I can't reproduce the error.


@Override
public long create(Canvas canvas, GLData data, GLData effective) throws AWTException {
effective.swapInterval = null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows already implements the function for the swapInterval call, so this is an unnecessary duplication (see).

canvas.swapBuffers();
} finally {
canvas.unlock();
if (canvas.lock()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could be a problem, since if the lock() function fails and throws an exception, the application could crash, given that the unlock() function would never be called.

*/
public void swapBuffers() {
platformCanvas.swapBuffers();
public boolean swapBuffers() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is unnecessary...

* avoid conflicts when drawing on the canvas.
*/
public void lock() {
public boolean lock() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is unnecessary...

/** Logger class. */
private static final Logger LOGGER = Logger.getLogger(LwjglCanvas.class.getName());

static boolean swapBuffersAndCheckNativeVsync(boolean nativeVsyncEnabled,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't think this static method is necessary, since it is only used once and could be integrated directly into the code block where it is required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants