Jogl/Jogamp on Java 9

classic Classic list List threaded Threaded
111 messages Options
1 ... 3456
Reply | Threaded
Open this post in threaded view
|

Semantic Java3D/JOGAMP jdk9 errors on windows

Douglas Lyon
Hi All,
It appears there is a 3d clipping window issue (subtle) in Java3d/jogamp with jdk9, but only for windows.
Here is a nice video I made in youtube;
https://www.youtube.com/watch?v=iXIG47iOolY

I am getting the same reports from others and have encouraged them to post to this list.

With semantic errors, like clipping, I am thinking we should devise a test
for windows that exercises jogl and clipping, just to pin-point the cause of the error a little
better (jogl vs java3d?).

Thanks!
 - Doug
Reply | Threaded
Open this post in threaded view
|

Re: Semantic Java3D/JOGAMP jdk9 errors on windows

gouessej
Administrator
Hi

Please can you confirm that it doesn't occur with Java 1.8? Maybe it has something to do with HiDPI, can you test your example with "-Dsun.java2d.dpiaware=false"?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Jogl/Jogamp on Java 9

Andy Skinner
In reply to this post by gouessej
Julien said:
"You can disable HiDPI until you're ready to fully take it into account. When HiDPI is enabled, the surface dimension (in pixel units) isn't equal to the window dimension (in window units). Look at com.jogamp.nativewindow.NativeWindow and com.jogamp.nativewindow.NativeSurface. If you use getWidth() and getHeight() everywhere, you'll have to replace some calls by getSurfaceWidth() and getSurfaceHeight()."

Will JOGL handle high DPI for Windows as it did for Mac?  I don't know whether there was mac-specific code, or whether JOGL just recognizes the scale is there, and Java being highDPI aware will just work.  We already work with high-DPI JOGL on Mac, and I wonder whether JOGL will do its part on Windows now.  It did not appear to be scaling now.

thanks
andy
Reply | Threaded
Open this post in threaded view
|

Re: Jogl/Jogamp on Java 9

gouessej
Administrator
I think that there is nothing more to do in JOGL to support HiDPI under Windows but I'm not 100% sure, maybe Sven can confirm.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Jogl/Jogamp on Java 9

Andy Skinner
I wrote a simple program that creates a GLJPanel and prints out the surface scale, surface size, and component size.

On Mac with Retina, I get surface scale of 2, and surface size is twice the component size.  (getSurfaceWidth vs getWidth)

On Windows running with Java 10, I still get surface scale of 1 and surface size the same as component size.

My understanding of the Java 9 Windows high DPI change was that Windows would work more like Mac.

My Windows display is set to magnify by 150%.  Should I have seen something like what I saw on mac?

I don't see an attach button, so I'll just give you the code.

thanks
andy

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

import com.jogamp.opengl.*;
import com.jogamp.opengl.awt.*;

public class winHiDPI extends JFrame implements GLEventListener {

    GLJPanel fCanvas;

    winHiDPI() {
        setSize(400,300);

        GLCapabilities caps = new GLCapabilities(null);

        fCanvas = new GLJPanel(caps);
        fCanvas.addGLEventListener(this);
        fCanvas.setAutoSwapBufferMode(true);
        getContentPane().add(fCanvas, BorderLayout.CENTER);

        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                getContentPane().remove(fCanvas);
            }
        });
    }

    @Override
    public void init(GLAutoDrawable d) {
        final GL2 gl = d.getGL().getGL2();
        gl.glClearColor(1.0f, 1.0f, 0.5f, 1.0f);

        float[] scales = new float[2];
        fCanvas.getCurrentSurfaceScale(scales);
        System.out.println("surface scale: " + scales[0] + " " + scales[1]);
        System.out.println("surface size: " +
                           fCanvas.getSurfaceWidth() + " " + fCanvas.getSurfaceHeight());
        System.out.println("Component size: " +
                           fCanvas.getWidth() + " " + fCanvas.getHeight());
    }
       
    @Override
    public void display(GLAutoDrawable d) {
        final GL2 gl = d.getGL().getGL2();
        gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
        gl.glLoadIdentity();

        gl.glColor3f(0.0f, 0.0f, 1.0f);
        gl.glBegin(GL.GL_TRIANGLES);
        gl.glVertex3f(-0.5f, -0.5f, 0.0f);
        gl.glVertex3f( 0.5f, -0.5f, 0.0f);
        gl.glVertex3f( 0.0f,  0.5f, 0.0f);
        gl.glEnd();
    }

    @Override
    public void reshape(GLAutoDrawable d,int x,int y,int w,int h) {
    }

    @Override
    public void dispose(GLAutoDrawable d) {
    }

    public static void main(String[] args) {
        final winHiDPI frame = new winHiDPI();
        frame.setVisible(true);
    }
}
Reply | Threaded
Open this post in threaded view
|

Re: Jogl/Jogamp on Java 9

douglaslyon
Hi Andy,
I do remember totally struggling with the micro size
on windows, I have never tried this with a retina display on the mac.
I guess I need one to debug the problem.
So far, for me, anyway, things look ok. Sorry I can't help!
Please keep me posted on what you do to solve the problem.

Thanks!
  - Doug


On 6/14/18 4:03 PM, Andy Skinner [via jogamp] wrote:

> I wrote a simple program that creates a GLJPanel and prints out the
> surface scale, surface size, and component size.
>
> On Mac with Retina, I get surface scale of 2, and surface size is twice
> the component size.  (getSurfaceWidth vs getWidth)
>
> On Windows running with Java 10, I still get surface scale of 1 and
> surface size the same as component size.
>
> My understanding of the Java 9 Windows high DPI change was that Windows
> would work more like Mac.
>
> My Windows display is set to magnify by 150%.  Should I have seen
> something like what I saw on mac?
>
> I don't see an attach button, so I'll just give you the code.
>
> thanks
> andy
>
> import java.awt.*;
> import java.awt.event.*;
> import javax.swing.*;
>
> import com.jogamp.opengl.*;
> import com.jogamp.opengl.awt.*;
>
> public class winHiDPI extends JFrame implements GLEventListener {
>
>      GLJPanel fCanvas;
>
>      winHiDPI() {
>          setSize(400,300);
>
>          GLCapabilities caps = new GLCapabilities(null);
>
>          fCanvas = new GLJPanel(caps);
>          fCanvas.addGLEventListener(this);
>          fCanvas.setAutoSwapBufferMode(true);
>          getContentPane().add(fCanvas, BorderLayout.CENTER);
>
>          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>
>          addWindowListener(new WindowAdapter() {
>              public void windowClosing(WindowEvent e) {
>                  getContentPane().remove(fCanvas);
>              }
>          });
>      }
>
>      @Override
>      public void init(GLAutoDrawable d) {
>          final GL2 gl = d.getGL().getGL2();
>          gl.glClearColor(1.0f, 1.0f, 0.5f, 1.0f);
>
>          float[] scales = new float[2];
>          fCanvas.getCurrentSurfaceScale(scales);
>          System.out.println("surface scale: " + scales[0] + " " +
> scales[1]);
>          System.out.println("surface size: " +
>                             fCanvas.getSurfaceWidth() + " " +
> fCanvas.getSurfaceHeight());
>          System.out.println("Component size: " +
>                             fCanvas.getWidth() + " " +
> fCanvas.getHeight());
>      }
>
>      @Override
>      public void display(GLAutoDrawable d) {
>          final GL2 gl = d.getGL().getGL2();
>          gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
>          gl.glLoadIdentity();
>
>          gl.glColor3f(0.0f, 0.0f, 1.0f);
>          gl.glBegin(GL.GL_TRIANGLES);
>          gl.glVertex3f(-0.5f, -0.5f, 0.0f);
>          gl.glVertex3f( 0.5f, -0.5f, 0.0f);
>          gl.glVertex3f( 0.0f,  0.5f, 0.0f);
>          gl.glEnd();
>      }
>
>      @Override
>      public void reshape(GLAutoDrawable d,int x,int y,int w,int h) {
>      }
>
>      @Override
>      public void dispose(GLAutoDrawable d) {
>      }
>
>      public static void main(String[] args) {
>          final winHiDPI frame = new winHiDPI();
>          frame.setVisible(true);
>      }
> }
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
> http://forum.jogamp.org/Jogl-Jogamp-on-Java-9-tp4038012p4038934.html
> To unsubscribe from Jogl/Jogamp on Java 9, click here
> <
> NAML
> <
http://forum.jogamp.org/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
Reply | Threaded
Open this post in threaded view
|

Re: Jogl/Jogamp on Java 9

Andy Skinner
You can see the problem by just increasing the scale (I use 150%, but 125% will do, I think) on a Windows machine and using Java 9 or higher.  Java 9 will make a larger window than Java 8, but will not scale between surface and component.

You don't have to have Mac Retina.  Doing it that way was just comparison.

We could look at what Sven did to recognize when a Mac was using high DPI.  At the time, Windows did not work that way, so nothing was needed there to recognize high DPI.

I'd file a bug, but bugzilla isn't working yet.

andy
Reply | Threaded
Open this post in threaded view
|

Re: Jogl/Jogamp on Java 9

doug
The problem is hard.
Please PM me at lyon@docjava.com
Thanks!
 - Doug
Reply | Threaded
Open this post in threaded view
|

Re: Jogl/Jogamp on Java 9

Xerxes Rånby
JOGL 2.3.2 uses the Windows GDI and GDI+ API's that are supported using a wide range of windows version ranging from windows xp, vista to 10
the GDI and GDI+ windows API's have limitations when the application is running on high dpi screens, a summary of GDI application limitations is summarized in this article:
the article do not mention GDI + OpenGL applications however the limitations are identical to GDI + D3D applications

Starting with Windows 10 Creators Update (1703) new API are introduced that applications must use to become "Per-Monitor V2" aware.

As I see it the situation of High dpi + opengl may be improved by using the API introduced in windows 10. JOGL may be updated to use the new API's if available and still use the old API's for maximum windows compatibility with earlier windows versions.




2018-06-15 13:55 GMT+02:00 doug [via jogamp] <[hidden email]>:
The problem is hard.
Please PM me at [hidden email]
Thanks!
 - Doug



If you reply to this email, your message will be added to the discussion below:
http://forum.jogamp.org/Jogl-Jogamp-on-Java-9-tp4038012p4038937.html
To start a new topic under jogl, email [hidden email]
To unsubscribe from jogamp, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: Jogl/Jogamp on Java 9

Andy Skinner
Xerxes' comments make sense to me.
andy
Reply | Threaded
Open this post in threaded view
|

Re: Jogl/Jogamp on Java 9

gouessej
Administrator
In reply to this post by doug
doug wrote
The problem is hard.
Please PM me at lyon@docjava.com
I'd prefer everybody to work openly with transparency here.
Julien Gouesse | Personal blog | Website
1 ... 3456