Mouse cursor flipped and wrong colors

Hello monkeys!

I did an update to the recently released 3.1-beta2 and then noticed that my mouse cursor was upside down and also had weird colors. I’m using inputManager.setMouseCursor(JmeCursor).
Tried different .cur files, and those who could load were all flipped.

Turned out it was LWJGL 3 that expects the image in a different format: RGBA instead of ARGB and, well, vertically flipped.

I commited a fix here: Fixes mouse cursor format for LWJGL3 · FennelFetish/jmonkeyengine@54c854b · GitHub

It’s based on this answer on gamedev.stackexchange: mouse - Setting up a custom cursor image in LWJGL 3 - Game Development Stack Exchange

Works for me. I’m curious though: Can you reproduce the issue? Seems unlikely that something like that goes unnoticed… How do you guys load cursors?

My guess is that the subset of folks who are using lwjgl3 probably don’t load cursors. Neither is all that common and the intersecting set is likely pretty small.

I also had this problem when I tried LWJGL 3 awhile back…

I thought a custom cursor is the basis of every game :stuck_out_tongue:

Thanks, so it’s not only me.
I made a pull request. That’s my first :slight_smile:

Is master branch for version 3.2?

Yes master will become 3.2 someday

Yes, well, the cursor with LWJGL 2 was bugged for years with 3.0 and 3.1. So apparently the computer says no :slight_smile:

To be be 100% accurate, it couldn’t handle too many changes. So if you had just one cursor, that would have been just fine. But even swapping between 2 would eventually crash your app.

Also many use software cursors, eg glorified quad mesh and do the logic themselfes

@tonihele That’s good to know. From what I’ve gathered this was fixed for LWJGL3, right? (by using that HashMap)

@Empire_Phoenix That’s probably the reason why this wasn’t noticed. I also use a type of homegrown cursor to keep the “rotating icon” cursor at a fixed position when rotating a ChaseCamera.
Looks so hackish to mix this.

But it’s so much easier to use JmeCursor. Support for animated cursors in LWJGL3 would be nice though.

Yes, the LWJGL 3 version seemed to have came out with the problem already addressed. LWJGL 2 fix was just c + p really from there.

Indeed, I rely this on LWJGL 2 and it works.