cursor() command with PImage stopped working in processing 3.0.

edited September 2015 in Questions about Code

I have been working on a project which involved changing the cursor with the cursor() command. I switched to processing 3, and now this command doesn't work at all.

PImage cursor;

void setup(){

size(200, 200, P2D);

cursor = loadImage("Cursor.png");

image(cursor, 0, 0);

cursor(cursor);

}

This creates a screen with the image properly loaded in the top left corner as it should, but it does not change the cursor. It seem that this command is no longer supported, is there an equivalent way to do this in the new version or a way to make this work?

Answers

  • Answer ✓

    You could try to turn off the normal mouse cursor using noCursor() and then make the image's location at mouseX and mouseY.

  • I suspect if they call cursor() again during draw() it may work, but this is news to me.

    can you test?

  • It doesn't seem to work in draw().

    Sometimes, in a larger piece of code I get an red message "Cursor types no longer supported in OpenGL, please provide your cursor image" I am providing the image, so I don't know why I am getting this. The code sometimes prints (not in red) "Disposing of texture resource" Repeatedly

  • Neither of these occur dependably.

  • I made this work using noCursor and drawing an image at that position. It is interesting to me that the cursor(img) command is still in processing when it doesn't do anything.

  • Answer ✓

    According to the source code comments cursor() methid is not implemented for P2D & P3D. I assume it will be at some time in the future.

  • I think this is fixed with the latest version of Processing. It certainly fixed this issue

Sign In or Register to comment.