Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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? |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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; } |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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 |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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? |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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 |
Loading... |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Any chance this will get implemented sometime in the near future? Also is there a way to hide the cursor in the meantime?
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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 |
Free forum by Nabble | Edit this page |