public static Point3d intersectPointWithXYPlane(GLAutoDrawable drawable, int rawMouseX, int rawMouseY) { int[] raw = {rawMouseX, rawMouseY}; int[] coords = drawable.getNativeSurface().convertToPixelUnits(raw); int mouseX = coords[0]; int mouseY = coords[1]; Vector3[] mouseRay = getRayFromMouse(drawable, mouseX, mouseY); Vector3 R1 = mouseRay[0]; Vector3 R2 = mouseRay[1]; Vector3 S1 = new Vector3(-1., 1., 0); Vector3 S2 = new Vector3(1., 1., 0); Vector3 S3 = new Vector3(-1., -1., 0); return intersectPointWithPlane(R1, R2, S1, S2, S3); }
public static final boolean isLockedByThisThread(final GLAutoDrawable d) { final Thread currentThread = Thread.currentThread(); final Thread upstreamLockOwner = d.getUpstreamLock().getOwner(); if( currentThread == upstreamLockOwner ) { return true; } else { final NativeSurface s = d.getNativeSurface(); final Thread surfaceLockOwner = null != s ? s.getSurfaceLockOwner() : null; return currentThread == surfaceLockOwner; } }
public static final boolean isLockedByThisThread(final GLAutoDrawable d) { final Thread currentThread = Thread.currentThread(); final Thread upstreamLockOwner = d.getUpstreamLock().getOwner(); if( currentThread == upstreamLockOwner ) { return true; } else { final NativeSurface s = d.getNativeSurface(); final Thread surfaceLockOwner = null != s ? s.getSurfaceLockOwner() : null; return currentThread == surfaceLockOwner; } }
public static final boolean isLockedByOtherThread(final GLAutoDrawable d) { final Thread currentThread = Thread.currentThread(); final Thread upstreamLockOwner = d.getUpstreamLock().getOwner(); if( null != upstreamLockOwner && currentThread != upstreamLockOwner ) { return true; } else { final NativeSurface s = d.getNativeSurface(); final Thread surfaceLockOwner = null != s ? s.getSurfaceLockOwner() : null; return null != surfaceLockOwner && currentThread != surfaceLockOwner; } }
public static final boolean isLockedByOtherThread(final GLAutoDrawable d) { final Thread currentThread = Thread.currentThread(); final Thread upstreamLockOwner = d.getUpstreamLock().getOwner(); if( null != upstreamLockOwner && currentThread != upstreamLockOwner ) { return true; } else { final NativeSurface s = d.getNativeSurface(); final Thread surfaceLockOwner = null != s ? s.getSurfaceLockOwner() : null; return null != surfaceLockOwner && currentThread != surfaceLockOwner; } }
@Override public void init(final GLAutoDrawable drawable) { final MonitorDevice monitor = glWindow.getMainMonitor(); System.err.println("Main Monitor: "+monitor); final float[] pixelPerMM = monitor.getPixelsPerMM(new float[2]); System.err.println(" pixel/mm ["+pixelPerMM[0]+", "+pixelPerMM[1]+"]"); System.err.println(" pixel/in ["+pixelPerMM[0]*25.4f+", "+pixelPerMM[1]*25.4f+"]"); final GL gl = drawable.getGL(); System.err.println(JoglVersion.getGLInfo(gl, null)); System.err.println("Requested: "+drawable.getNativeSurface().getGraphicsConfiguration().getRequestedCapabilities()); System.err.println("Chosen : "+drawable.getChosenGLCapabilities()); System.err.println("GL impl. class "+gl.getClass().getName()); if( gl.isGL4ES3() ) { final GL4ES3 _gl = gl.getGL4ES3(); System.err.println("GL4ES3 retrieved, impl. class "+_gl.getClass().getName()); } if( gl.isGL3() ) { final GL3 _gl = gl.getGL3(); System.err.println("GL3 retrieved, impl. class "+_gl.getClass().getName()); } if( gl.isGLES3() ) { final GLES3 _gl = gl.getGLES3(); System.err.println("GLES3 retrieved, impl. class "+_gl.getClass().getName()); } if( gl.isGLES2() ) { final GLES2 _gl = gl.getGLES2(); System.err.println("GLES2 retrieved, impl. class "+_gl.getClass().getName()); } }
private Point3f getOGLPos(int x, int y) { int[] xy = new int[2]; xy[0] = x; xy[1] = y; ((GLAutoDrawable) canvas).getNativeSurface().convertToPixelUnits(xy); x = xy[0]; y = xy[1]; double[] obj_pos = new double[3]; float winX, winY;//, winZ = cameraStart.getZ(); float posX, posY;//, posZ; double[] w_pos = new double[3]; winX = x; winY = viewport[3] - y; GLU glu = new GLU(); obj_pos[2]=0; // Check view relative z-koord of layer zero == visnet layer glu.gluProject( obj_pos[0], obj_pos[1],obj_pos[2], modelview,0, projection,0, viewport,0, w_pos,0); glu.gluUnProject( winX, winY, w_pos[2], modelview,0, projection,0, viewport,0, obj_pos,0); posX = (float)obj_pos[0]; posY = (float)obj_pos[1]; return new Point3f(posX, posY, 0); }
/** * Convenient wrapper for {@link GLDrawableFactory#resetDisplayGamma(com.jogamp.nativewindow.NativeSurface)} * locking {@link GLAutoDrawable#getUpstreamLock()} to ensure proper atomic operation. */ public static void resetDisplayGamma(final GLAutoDrawable drawable) { final RecursiveLock lock = drawable.getUpstreamLock(); lock.lock(); try { GLDrawableFactory.getFactory(drawable.getGLProfile()).resetDisplayGamma(drawable.getNativeSurface()); } finally { lock.unlock(); } }
/** * Convenient wrapper for {@link GLDrawableFactory#setDisplayGamma(com.jogamp.nativewindow.NativeSurface, float, float, float)} * locking {@link GLAutoDrawable#getUpstreamLock()} to ensure proper atomic operation. */ public static boolean setDisplayGamma(final GLAutoDrawable drawable, final float gamma, final float brightness, final float contrast) throws IllegalArgumentException { final RecursiveLock lock = drawable.getUpstreamLock(); lock.lock(); try { return GLDrawableFactory.getFactory(drawable.getGLProfile()).setDisplayGamma(drawable.getNativeSurface(), gamma, brightness, contrast); } finally { lock.unlock(); } }
/** * Convenient wrapper for {@link GLDrawableFactory#resetDisplayGamma(com.jogamp.nativewindow.NativeSurface)} * locking {@link GLAutoDrawable#getUpstreamLock()} to ensure proper atomic operation. */ public static void resetDisplayGamma(final GLAutoDrawable drawable) { final RecursiveLock lock = drawable.getUpstreamLock(); lock.lock(); try { GLDrawableFactory.getFactory(drawable.getGLProfile()).resetDisplayGamma(drawable.getNativeSurface()); } finally { lock.unlock(); } }
if (button == 1) { int startxy[] = new int[]{OTFOGLDrawer.this.start.x, OTFOGLDrawer.this.start.y}; ((GLAutoDrawable) OTFOGLDrawer.this.canvas).getNativeSurface().convertToPixelUnits(startxy); int endxy[] = new int[]{e.getX(), e.getY()}; ((GLAutoDrawable) OTFOGLDrawer.this.canvas).getNativeSurface().convertToPixelUnits(endxy); int deltax = Math.abs(startxy[0] - endxy[0]); int deltay = Math.abs(startxy[1] - endxy[1]);
/** * Convenient wrapper for {@link GLDrawableFactory#setDisplayGamma(com.jogamp.nativewindow.NativeSurface, float, float, float)} * locking {@link GLAutoDrawable#getUpstreamLock()} to ensure proper atomic operation. */ public static boolean setDisplayGamma(final GLAutoDrawable drawable, final float gamma, final float brightness, final float contrast) throws IllegalArgumentException { final RecursiveLock lock = drawable.getUpstreamLock(); lock.lock(); try { return GLDrawableFactory.getFactory(drawable.getGLProfile()).setDisplayGamma(drawable.getNativeSurface(), gamma, brightness, contrast); } finally { lock.unlock(); } }
srcUpstreamLock.lock(); try { final NativeSurface srcSurface = src.getNativeSurface(); final boolean srcSurfaceLocked = NativeSurface.LOCK_SURFACE_NOT_READY < srcSurface.lockSurface(); if( src.isRealized() && !srcSurfaceLocked ) {
srcUpstreamLock.lock(); try { final NativeSurface srcSurface = src.getNativeSurface(); final boolean srcSurfaceLocked = NativeSurface.LOCK_SURFACE_NOT_READY < srcSurface.lockSurface(); if( src.isRealized() && !srcSurfaceLocked ) {
final boolean destIsRealized; try { final NativeSurface destSurface = dest.getNativeSurface(); final boolean destSurfaceLocked = NativeSurface.LOCK_SURFACE_NOT_READY < destSurface.lockSurface(); if( dest.isRealized() && !destSurfaceLocked ) {
final boolean destIsRealized; try { final NativeSurface destSurface = dest.getNativeSurface(); final boolean destSurfaceLocked = NativeSurface.LOCK_SURFACE_NOT_READY < destSurface.lockSurface(); if( dest.isRealized() && !destSurfaceLocked ) {
bUpstreamLock.lock(); try { final NativeSurface aSurface = a.getNativeSurface(); final boolean aSurfaceLocked = NativeSurface.LOCK_SURFACE_NOT_READY < aSurface.lockSurface(); if( a.isRealized() && !aSurfaceLocked ) { throw new GLException("Could not lock realized a surface "+a); final NativeSurface bSurface = b.getNativeSurface(); final boolean bSurfaceLocked = NativeSurface.LOCK_SURFACE_NOT_READY < bSurface.lockSurface(); if( b.isRealized() && !bSurfaceLocked ) {
bUpstreamLock.lock(); try { final NativeSurface aSurface = a.getNativeSurface(); final boolean aSurfaceLocked = NativeSurface.LOCK_SURFACE_NOT_READY < aSurface.lockSurface(); if( a.isRealized() && !aSurfaceLocked ) { throw new GLException("Could not lock realized a surface "+a); final NativeSurface bSurface = b.getNativeSurface(); final boolean bSurfaceLocked = NativeSurface.LOCK_SURFACE_NOT_READY < bSurface.lockSurface(); if( b.isRealized() && !bSurfaceLocked ) {