SWT GLCanvas renders incorrectly at 175% scaling and above on Windows

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

SWT GLCanvas renders incorrectly at 175% scaling and above on Windows

badjames
Hi,

I am using the SWT GLCanvas (com.jogamp.opengl.swt.GLCanvas) in JOGL 2.5.0.  Rendering works perfectly until I increase the Windows 10 scaling to 175% and beyond.  Then the canvas only renders to the bottom left quadrant, as below:



(In the above image, the square should encompass the entire dialog)

I can work around this to some degree by setting the viewport width and height to 2 times that of the reported canvas size.  However, I also use the TextRenderer class and that causes the text to appear blurry (because it is bitmap zooming x 2).

Is there a workaround for this?

Thanks,

James
Reply | Threaded
Open this post in threaded view
|

Re: SWT GLCanvas renders incorrectly at 175% scaling and above on Windows

badjames
Hi,

I've been playing with the NEWT GLCanvas which seems to allow me to avoid the scaling issue.  Basically, if I do the following:

1.  Set the surface scale value to 1.0f using:

    glCanvas.getNEWTChild().setSurfaceScale()

2.  Set the viewport size in the reshape callback with:

    gl.glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight());

    (where "drawable" is the first argument in the callback).

Then rendering appears correct at 175% scaling - it correctly fills the canvas and text is not scaled horribly.

Is this the recommended solution to handling 175%+ scaling, or is there a way I can get it to work using the com.jogamp.opengl.swt.GLCanvas instead?

Any help would be great, thanks :-)

James
Reply | Threaded
Open this post in threaded view
|

Re: SWT GLCanvas renders incorrectly at 175% scaling and above on Windows

badjames
In reply to this post by badjames
I'm probably talking to myself here, but a further update:

The NewtCanvasSWT works a dream on Windows, but unfortunately on Linux it is a mess.  Attempting to resize the canvas causes the rendered area to disappear off the canvas.  It appears that the X/Y location of the GLCanvas is set incorrectly somehow (it is 0,0 prior to resize and then seems to change to an absolute XY).

So unfortunately, I'm back to Eclipse/JOGL standard SWT canvas and broken handling of scaling....
Reply | Threaded
Open this post in threaded view
|

Re: SWT GLCanvas renders incorrectly at 175% scaling and above on Windows

gouessej
Administrator
badjames wrote
I'm probably talking to myself here, but a further update:
You aren't.

Maybe there is a bug report for this problem with a workaround, it reminds me something.

Sorry, it's not the best time to provide some help for me.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: SWT GLCanvas renders incorrectly at 175% scaling and above on Windows

badjames
No problem, thanks for responding :-)

I think for the moment I'll see if I can abstract things so Windows can take advantage of the NEWT canvas, but Linux will use the older SWT canvas.  Most of my users will likely be on Windows anyway, so poor scaling on Linux may not be an issue.

If you do think of anything, let me know and I'll revise things.

Merry Xmas :-)

James