GLWindow Cursor problems

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

GLWindow Cursor problems

Itun
How to set a cursor for GLWindow?
I put my GLWindow to JPanel and hide its cursor :

        // Transparent 16 x 16 pixel cursor image.
        BufferedImage cursorImg = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);

        // Create a new blank cursor.
        blankCursor = Toolkit.getDefaultToolkit().createCustomCursor(
                cursorImg, new Point(0, 0), "blank cursor");
       
        jPanelwithGLWindow.setCursor(blankCursor);
It does not work.
Than I hide a JFrame cursor with this method. Everywhere in the JFrame it is transparent, but I see it as a default cursor in GLWindow.

How to set cursor position on the GLWindow?
Reply | Threaded
Open this post in threaded view
|

Re: GLWindow Cursor problems

Demoscene Passivist
Administrator
Here's the snippet that works for me, maybe u should give it a try:

    public static Cursor createHiddenCursor() {
        Toolkit tToolkit = Toolkit.getDefaultToolkit();
        Dimension tDimension = tToolkit.getBestCursorSize(1, 1);
        BufferedImage tCursorImage = new BufferedImage(tDimension.width, tDimension.height, BufferedImage.TYPE_INT_ARGB);
        Graphics2D tGraphics2D = tCursorImage.createGraphics();
        tGraphics2D.setBackground(new Color(0.0f, 0.0f, 0.0f, 0.0f));
        tGraphics2D.clearRect(0, 0, tDimension.width, tDimension.height);
        tGraphics2D.dispose();
        Cursor tHiddenCursor = tToolkit.createCustomCursor(tCursorImage, new Point(0,0), "HiddenCursor");
        return tHiddenCursor;
    }
Reply | Threaded
Open this post in threaded view
|

Re: GLWindow Cursor problems

gouessej
Administrator
Your snippet would work with a GLCanvas but not with NEWT. As far as I know, it is not yet possible to change the cursor in NEWT. Maybe it has recently changed.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GLWindow Cursor problems

Demoscene Passivist
Administrator
>Your snippet would work with a GLCanvas but not with NEWT. As far as I know,
>it is not yet possible to change the cursor in NEWT. Maybe it has recently changed.

Ups, sorry I overread the "GLWindow" part and thought it was an AWT related problem. Regarding the NEWT cursor issue u are exactly right it is currently NOT possible to change the cursor with NEWT. Actually I already filed a bugreport regarding this issue a couple of months ago: https://jogamp.org/bugzilla/show_bug.cgi?id=409
Reply | Threaded
Open this post in threaded view
|

Re: GLWindow Cursor problems

Itun
Ok, I have understood everything with the first question. But what do you know about the second:
How to set cursor position on the GLWindow?
Reply | Threaded
Open this post in threaded view
|

Re: GLWindow Cursor problems

Sven Gothel
Administrator
On Saturday, April 02, 2011 05:50:53 pm Itun [via jogamp] wrote:
>
> Ok, I have understood everything with the first question. But what do you
> know about the second:
> How to set cursor position on the GLWindow?
>
>



We need to impl it for a NEWT Window.

Any volunteers doing it on windows ?

Then I will follow on X11 :)

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: GLWindow Cursor problems

Mike
Any chance this will get implemented sometime in the near future? Also is there a way to hide the cursor in the meantime?
Reply | Threaded
Open this post in threaded view
|

Re: GLWindow Cursor problems

gouessej
Administrator
Hi

It has been implemented and it is already used in my first person shooter. Use the method GLWindow.setPointerVisible(boolean) to show/hide the cursor.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GLWindow Cursor problems

Sven Gothel
Administrator
On Wednesday, January 11, 2012 11:04:36 AM gouessej [via jogamp] wrote:
>
> Hi
>
> It has been implemented and it is already used in my first person shooter.
> Use the method GLWindow.setPointerVisible(boolean) to show/hide the cursor.
>

Yup:

https://jogamp.org/bugzilla/show_activity.cgi?id=409
http://wiki.eclipse.org/Development_Resources/HOWTO/Bugzilla_Use

Anyone interested in progress of a bug fix can easily add themselves
to the 'CC List' (after account creation) and gets notified by email.

~Sven