public void setAlphaToCoverage(boolean value) { if (value) { glEnable(ARBMultisample.GL_SAMPLE_ALPHA_TO_COVERAGE_ARB); } else { glDisable(ARBMultisample.GL_SAMPLE_ALPHA_TO_COVERAGE_ARB); } }
public final static void dumpWindowInfo() { int r = GLUtils.getGLInteger(GL11.GL_RED_BITS); int g = GLUtils.getGLInteger(GL11.GL_GREEN_BITS); int b = GLUtils.getGLInteger(GL11.GL_BLUE_BITS); int a = GLUtils.getGLInteger(GL11.GL_ALPHA_BITS); int depth = GLUtils.getGLInteger(GL11.GL_DEPTH_BITS); int stencil = GLUtils.getGLInteger(GL11.GL_STENCIL_BITS); int sample_buffers = 0; int samples = 0; if (GLContext.getCapabilities().GL_ARB_multisample) { sample_buffers = GLUtils.getGLInteger(ARBMultisample.GL_SAMPLE_BUFFERS_ARB); samples = GLUtils.getGLInteger(ARBMultisample.GL_SAMPLES_ARB); } System.out.println("r = " + r + " | g = " + g + " | b = " + b + " | a = " + a + " | depth = " + depth + " | stencil = " + stencil + " | sample_buffers = " + sample_buffers + " | samples = " + samples); }
protected void createContext(AppSettings settings) throws LWJGLException{ DisplayMode displayMode = null; if (settings.getWidth() <= 0 || settings.getHeight() <= 0){ displayMode = Display.getDesktopDisplayMode(); settings.setResolution(displayMode.getWidth(), displayMode.getHeight()); }else if (settings.isFullscreen()){ displayMode = getFullscreenDisplayMode(settings.getWidth(), settings.getHeight(), settings.getBitsPerPixel(), settings.getFrequency()); if (displayMode == null) throw new RuntimeException("Unable to find fullscreen display mode matching settings"); }else{ displayMode = new DisplayMode(settings.getWidth(), settings.getHeight()); } PixelFormat pf = new PixelFormat(settings.getBitsPerPixel(), 0, settings.getDepthBits(), settings.getStencilBits(), settings.getSamples()); frameRate = settings.getFrameRate(); logger.log(Level.INFO, "Selected display mode: {0}", displayMode); boolean pixelFormatChanged = false; if (created.get() && (pixelFormat.getBitsPerPixel() != pf.getBitsPerPixel() ||pixelFormat.getDepthBits() != pf.getDepthBits() ||pixelFormat.getStencilBits() != pf.getStencilBits() ||pixelFormat.getSamples() != pf.getSamples())){ renderer.resetGLObjects(); Display.destroy(); pixelFormatChanged = true; } pixelFormat = pf; Display.setTitle(settings.getTitle()); if (displayMode != null){ if (settings.isFullscreen()){ Display.setDisplayModeAndFullscreen(displayMode); }else{ Display.setFullscreen(false); Display.setDisplayMode(displayMode); } }else{ Display.setFullscreen(settings.isFullscreen()); } if (settings.getIcons() != null) { Display.setIcon(imagesToByteBuffers(settings.getIcons())); } Display.setVSyncEnabled(settings.isVSync()); if (created.get() && !pixelFormatChanged){ Display.releaseContext(); Display.makeCurrent(); Display.update(); } if (!created.get() || pixelFormatChanged){ ContextAttribs attr = createContextAttribs(); if (attr != null){ Display.create(pixelFormat, attr); }else{ Display.create(pixelFormat); } renderable.set(true); if (pixelFormatChanged && pixelFormat.getSamples() > 1 && GLContext.getCapabilities().GL_ARB_multisample){ GL11.glEnable(ARBMultisample.GL_MULTISAMPLE_ARB); } } }