LWJGL Forum

Programming => Bug Reports / RFE => Topic started by: mudlee on October 23, 2019, 18:46:18

Title: NanoVG nvgImagePattern draws at wrong position on OSX?
Post by: mudlee on October 23, 2019, 18:46:18
First time (yes, really) that I'm trying to draw an image with nanovg. It works perfect on simple HD and 4K monitor on Linux, but on OSX (macbook pro with retina screen) the image's position is incorrect.

I'm drawing a simple png with a cursor at the mouse's position. Top-left (0,0) is correct but as soon as I go to let's say bottom-right, the diff between the cursor's real position and the png's position is like quadratic (when the real cursor at the bottom rigth, the png is somewhere 1/4 from the top left). Am I missing something?

Code:
Code: [Select]
float x = image.getPosition().getLeft();
float y = image.getPosition().getTop();

int imageID = nvglCreateImageFromHandle(pointer, image.getTextureId(), width, height, 0);
NVGPaint paint = NVGPaint.create();
nvgImagePattern(pointer, x, y, width, height, 0, imageID, 1f, paint);
nvgBeginPath(pointer);
nvgRect(pointer, x, y, width, height);
nvgFillPaint(pointer, paint);
nvgFill(pointer);
Title: Re: NanoVG nvgImagePattern draws at wrong position on OSX?
Post by: mudlee on October 24, 2019, 10:18:05
OK, after digging more into the code, the problem is somewhere in my code, with the screen resolution.