/** * Returns the highest profile. * It selects the first of the set: {@link GLProfile#GL_PROFILE_LIST_MAX} * * @throws GLException if no profile is available for the device. * @see #GL_PROFILE_LIST_MAX */ public static GLProfile getMaximum(final AbstractGraphicsDevice device, final boolean favorHardwareRasterizer) throws GLException { return get(device, GL_PROFILE_LIST_MAX, favorHardwareRasterizer); }
public static GLProfile getCompatible(final EGLGraphicsDevice device, final int renderableType) { if(0 != (renderableType & EGLExt.EGL_OPENGL_ES3_BIT_KHR) && GLProfile.isAvailable(device, GLProfile.GLES3)) { return GLProfile.get(device, GLProfile.GLES3); } if(0 != (renderableType & EGL.EGL_OPENGL_ES2_BIT) && GLProfile.isAvailable(device, GLProfile.GLES2)) { return GLProfile.get(device, GLProfile.GLES2); } if(0 != (renderableType & EGL.EGL_OPENGL_ES_BIT) && GLProfile.isAvailable(device, GLProfile.GLES1)) { return GLProfile.get(device, GLProfile.GLES1); } if(0 != (renderableType & EGL.EGL_OPENGL_BIT)) { return GLProfile.getDefault(device); } return null; }
/** * Returns the availability of a profile on a device. * * @param device a valid AbstractGraphicsDevice, or <code>null</null> for the default device. * @param profile a valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..), * or <code>[ null, GL ]</code> for the default profile. * @return true if the profile is available for the device, otherwise false. */ public static boolean isAvailable(final AbstractGraphicsDevice device, final String profile) { initSingleton(); return isAvailableImpl(getProfileMap(device, false), profile); } private static boolean isAvailableImpl(final HashMap<String /*GLProfile_name*/, GLProfile> map, final String profile) {
public GLProfile getProfile() { // tries to get the most capable profile, programmable or fixed, desktop or embedded, forward or backward // compatible GLProfile profile = GLProfile.getMaximum(true); final boolean isForwardCompatible = (!profile.isGL4() && profile.isGL3() && !profile.isGL3bc()) || (profile.isGL4() && !profile.isGL4bc()); if (isForwardCompatible) { // Ardor3D doesn't support forward compatible yet profile = GLProfile.getMaxFixedFunc(true); } return profile; }
/** * set the default profile to current profile * * @return true if default profile supports shader language (GL2ES2) */ final static public boolean setDefaultProfile() { if (profile == null) { profile = GLProfile.getDefault(); isGL2ES2 = profile.isGL2ES2(); } return isGL2ES2; }
public JoglPanel(final TestbedModel model, final TestbedController controller) { super(new GLCapabilities(GLProfile.getDefault())); this.controller = controller; setSize(600, 600); setPreferredSize(new Dimension(600, 600)); setAutoSwapBufferMode(true); addGLEventListener(this); AWTPanelHelper.addHelpAndPanelListeners(this, model, controller, SCREEN_DRAG_BUTTON); }
/** * Tries to create a OpenGL Context. * <p/> * @throws GLException when anything prevents the creation, the exception * holds the underlying problem in its "Throwable" field. */ synchronized public void iniContext() throws GLException { assert initialized == false : "The Context is already initialized!"; GLProfile.initSingleton(); GLProfile profile = null; try { if (glProfil == null) { profile = GLProfile.getMinimum(true); } else { profile = GLProfile.get(glProfil); } } catch (Throwable t) { throw new GLException("Couldn't initialize OpenGL!", t); } window = GLWindow.create(getCapabilities(profile)); initialized = true; }
@Override public final GLProfile getGLProfile() { // FIXME: should do better than this; is it possible to query J2D's Profile ? return GLProfile.getDefault(GLProfile.getDefaultDevice()); }
glp = GLProfile.get(GLProfile.GL4ES3); } else if(forceGL3) { glp = GLProfile.get(GLProfile.GL3); } else if(forceES3) { glp = GLProfile.get(GLProfile.GLES3); } else if(forceES2) { glp = GLProfile.get(GLProfile.GLES2); } else { glp = GLProfile.getDefault();
protected static WindowsBitmapWGLDrawable create(final GLDrawableFactory factory, final NativeSurface comp) { final WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)comp.getGraphicsConfiguration(); final AbstractGraphicsDevice aDevice = config.getScreen().getDevice(); if( !GLProfile.isAvailable(aDevice, GLProfile.GL2) ) { throw new GLException("GLProfile GL2 n/a on "+aDevice+" but required for Windows BITMAP"); } final GLProfile glp = GLProfile.get(GLProfile.GL2); final GLCapabilitiesImmutable capsChosen0 = (GLCapabilitiesImmutable)config.getChosenCapabilities(); // RGB555 and also alpha channel is experienced to fail on some Windows machines final GLCapabilitiesImmutable capsChosen1 = GLGraphicsConfigurationUtil.clipRGBAGLCapabilities(capsChosen0, false /* allowRGB555 */, false /* allowAlpha */); final GLCapabilitiesImmutable capsChosen2 = GLGraphicsConfigurationUtil.fixGLProfile(capsChosen1, glp); if( capsChosen0 != capsChosen2 ) { config.setChosenCapabilities(capsChosen2); if(DEBUG) { System.err.println("WindowsBitmapWGLDrawable: "+capsChosen0+" -> "+capsChosen2); } } return new WindowsBitmapWGLDrawable(factory, comp); }
initSingleton(); final HashMap<String /*GLProfile_name*/, GLProfile> map = getProfileMap(device, false); doIndent(sb, indent, indentCount).append("Natives"); indentCount++; doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL4bc+" ").append(indent); } else { sb.append("Natives["+GL4bc+" "); avail=isAvailableImpl(map, GL4bc); sb.append(avail); if(avail) { nativeCount++; glAvailabilityToString(device, sb.append(" "), 4, GLContext.CTX_PROFILE_COMPAT); doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL4+" ").append(indent); } else { sb.append(", "+GL4+" "); avail=isAvailableImpl(map, GL4); sb.append(avail); if(avail) { nativeCount++; glAvailabilityToString(device, sb.append(" "), 4, GLContext.CTX_PROFILE_CORE); doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GLES3+" ").append(indent); } else { sb.append(", "+GLES3+" ");
/** * Returns the GLProfile's major version number at reqMajorCTP[0] and it's context property (CTP) at reqMajorCTP[1] for availability mapping request. */ protected static final void getRequestMajorAndCompat(final GLProfile glp, final int[/*2*/] reqMajorCTP) { final GLProfile glpImpl = glp.getImpl(); if( glpImpl.isGL4() ) { reqMajorCTP[0]=4; } else if ( glpImpl.isGL3() || glpImpl.isGLES3() ) { reqMajorCTP[0]=3; } else if (glpImpl.isGLES1()) { reqMajorCTP[0]=1; } else /* if (glpImpl.isGL2() || glpImpl.isGLES2()) */ { reqMajorCTP[0]=2; } if( glpImpl.isGLES() ) { reqMajorCTP[1]=CTX_PROFILE_ES; } else if( glpImpl.isGL2() ) { // incl GL3bc and GL4bc reqMajorCTP[1]=CTX_PROFILE_COMPAT; } else { reqMajorCTP[1]=CTX_PROFILE_CORE; } }
GLProfile.initSingleton(); // ensure JOGL is completly initialized this.capsRequested = new GLCapabilities(GLProfile.getDefault(screen.getDevice())); } else { this.capsRequested = (GLCapabilitiesImmutable) capsReqUser.cloneMutable();
/** * Returns the sole GLDrawableFactory instance for the desktop (X11, WGL, ..) if exist or null */ public static GLDrawableFactory getDesktopFactory() { GLProfile.initSingleton(); return nativeOSFactory; }
@Override protected boolean createImpl(final long shareWithHandle) throws GLException { final MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration(); final GLCapabilitiesImmutable capabilitiesChosen = (GLCapabilitiesImmutable) config.getChosenCapabilities(); final GLProfile glp = capabilitiesChosen.getGLProfile(); if( glp.isGLES() || ( glp.isGL3() && !isLionOrLater ) || ( glp.isGL4() && !isMavericksOrLater ) ) { throw new GLException("OpenGL profile not supported on MacOSX "+Platform.getOSVersionNumber()+": "+glp); } if( 0 != shareWithHandle && GLBackendType.NSOPENGL != getOpenGLMode() ) { throw new GLException("Context sharing only supported in mode "+GLBackendType.NSOPENGL+": "+this); } contextHandle = createContextARB(shareWithHandle, true); return 0 != contextHandle; }
public boolean isValidArrayDataType(final int index, final int comps, final int type, final boolean isVertexAttribPointer, final boolean throwException) { final String arrayName = getGLArrayName(index); if( isGLES1() ) { if(isVertexAttribPointer) { if(throwException) { } else if( isGLES2() ) { } else if( isGL2ES2() ) { if(isVertexAttribPointer) { switch(type) {
throws GLException initSingleton(); return map; if( !initProfilesForDevice(device) ) { if( throwExceptionOnZeroProfile ) { throw new GLException("No Profile available for "+device);