Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
* MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
* ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
* DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
* ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
* DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
package jogamp.opengl.awt;
import java.awt.Graphics;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.HeadlessException;
import java.awt.Rectangle;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
import javax.media.opengl.GL;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
import com.jogamp.common.os.Platform;
import jogamp.common.os.PlatformPropsImpl;
import jogamp.opengl.Debug;
/** Defines integration with the Java2D OpenGL pipeline. This
integration is only supported in 1.6 and is highly experimental. */
public class Java2D {
private static boolean DEBUG = Debug.debug("Java2D");
private static boolean isHeadless;
private static boolean isOGLPipelineActive;
private static boolean isOGLPipelineResourceCompatible;
private static Method invokeWithOGLContextCurrentMethod;
private static Method isQueueFlusherThreadMethod;
private static Method getOGLViewportMethod;
private static Method getOGLScissorBoxMethod;
private static Method getOGLSurfaceIdentifierMethod;
// This one is currently optional and is only in very recent Mustang builds
private static Method getOGLTextureTypeMethod;
// The following methods and fields are needed for proper support of
// Frame Buffer Objects in the Java2D/OpenGL pipeline
// (-Dsun.java2d.opengl.fbobject=true)
private static boolean fbObjectSupportInitialized;
private static Method invokeWithOGLSharedContextCurrentMethod;
private static Method getOGLSurfaceTypeMethod;
// Publicly-visible constants for OpenGL surface types
public static final int UNDEFINED = getOGLUtilitiesIntField("UNDEFINED");
public static final int WINDOW = getOGLUtilitiesIntField("WINDOW");
public static final int PBUFFER = getOGLUtilitiesIntField("PBUFFER");
public static final int TEXTURE = getOGLUtilitiesIntField("TEXTURE");
public static final int FLIP_BACKBUFFER = getOGLUtilitiesIntField("FLIP_BACKBUFFER");
public static final int FBOBJECT = getOGLUtilitiesIntField("FBOBJECT");
// If FBOs are enabled in the Java2D/OpenGL pipeline, all contexts
// created by JOGL must share textures and display lists with the
// Java2D contexts in order to access the frame buffer object for
// potential rendering, and to simultaneously support sharing of
// textures and display lists with one another. Java2D has the
// notion of a single shared context with which all other contexts
// (on the same display device?) share textures and display lists;
// this is an approximation to that notion which will be refined
// later.
private static boolean initializedJ2DFBOShareContext;
private static GLContext j2dFBOShareContext;
// Accessors for new methods in sun.java2d.opengl.CGLSurfaceData
// class on OS X for enabling bridge
// public static long createOGLContextOnSurface(Graphics g, long ctx);
// public static boolean makeOGLContextCurrentOnSurface(Graphics g, long ctx);
// public static void destroyOGLContext(long ctx);
private static Method createOGLContextOnSurfaceMethod;
private static Method makeOGLContextCurrentOnSurfaceMethod;
private static Method destroyOGLContextMethod;
static {
AccessController.doPrivileged(new PrivilegedAction