Login  Register

Re: GL_ARB_vertex_buffer_object not available on Mac?

Posted by Wade Walker on Jan 06, 2019; 3:33pm
URL: https://forum.jogamp.org/GL-ARB-vertex-buffer-object-not-available-on-Mac-tp4039309p4039371.html

The solution is, instead of doing this in JAWTUtil.java:

final PrivilegedDataBlob1 pdb1 = (PrivilegedDataBlob1) AccessController.doPrivileged(new PrivilegedAction<Object>() {
    @Override
    public Object run() {
        final PrivilegedDataBlob1 d = new PrivilegedDataBlob1();
        try {
            final GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
            final Class<?> gdClass = gd.getClass();
            d.getScaleFactorMethod = gdClass.getDeclaredMethod("getScaleFactor");
            d.getScaleFactorMethod.setAccessible(true);
        } catch (final Throwable t) {}
        return d;
    }
});
...
final Object res = getScaleFactorMethod.invoke(device);
if (res instanceof Integer) {
    sx = ((Integer)res).floatValue();
} else if ( res instanceof Double) {
    sx = ((Double)res).floatValue();
}
sy = sx;

to now do this (since GraphicsConfiguration.getDefaultTransform() has been added):

GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
GraphicsConfiguration gc = gd.getDefaultConfiguration(); 
AffineTransform tx = gc.getDefaultTransform();
sx = (float)tx.getScaleX(); 
sy = (float)tx.getScaleY(); 

On a Windows PC with a 4K monitor, this returns 2.25 as the scale factor in both directions, which seems like the right answer. I'm trying on Mac next.