Refine search
boolean wasActive = true; while (running) { Display.processMessages(); if (Display.isCloseRequested()) exit(); boolean isActive = Display.isActive(); if (wasActive && !isActive) { // if it's just recently minimized from active state wasActive = false; graphics.config.x = Display.getX(); graphics.config.y = Display.getY(); if (graphics.resize || Display.wasResized() || (int)(Display.getWidth() * Display.getPixelScaleFactor()) != graphics.config.width || (int)(Display.getHeight() * Display.getPixelScaleFactor()) != graphics.config.height) { graphics.resize = false; graphics.config.width = (int)(Display.getWidth() * Display.getPixelScaleFactor()); graphics.config.height = (int)(Display.getHeight() * Display.getPixelScaleFactor()); Gdx.gl.glViewport(0, 0, graphics.config.width, graphics.config.height); if (listener != null) listener.resize(graphics.config.width, graphics.config.height); graphics.frameId++; listener.render(); Display.update(false); } else { if (frameRate > 0) Display.sync(frameRate); Display.destroy(); if (audio != null) audio.dispose();
if (getWidth() == width && getHeight() == height && !Display.isFullscreen()) { return true; org.lwjgl.opengl.DisplayMode[] modes = Display.getAvailableDisplayModes(); int freq = 0; org.lwjgl.opengl.DisplayMode current = modes[i]; if ((current.getBitsPerPixel() == Display.getDesktopDisplayMode().getBitsPerPixel()) && (current.getFrequency() == Display.getDesktopDisplayMode().getFrequency())) { targetDisplayMode = current; break; Display.setDisplayMode(targetDisplayMode); Display.setFullscreen(fullscreen); if (resizable == Display.isResizable()) { Display.setResizable(!resizable); Display.setResizable(resizable); float scaleFactor = Display.getPixelScaleFactor(); config.width = (int)(targetDisplayMode.getWidth() * scaleFactor); config.height = (int)(targetDisplayMode.getHeight() * scaleFactor);
@Override public void setTitle (String title) { Display.setTitle(title); }
public int getHeight () { if (canvas != null) return Math.max(1, canvas.getHeight()); else return (int)(Display.getHeight() * Display.getPixelScaleFactor()); }
public int getWidth () { if (canvas != null) return Math.max(1, canvas.getWidth()); else return (int)(Display.getWidth() * Display.getPixelScaleFactor()); }
private void updateFullScreenDisplay() throws LWJGLException { Display.setDisplayMode(getFullScreenDisplayMode()); Display.setFullscreen(true); Display.setLocation(0, 0); }
protected void setDisplayMode(int width, int height, boolean fullscreen) { try { DisplayMode mode = Display.getDisplayMode(); if (fullscreen == Display.isFullscreen() && mode.getWidth() == width && mode.getHeight() == height) return; for (DisplayMode test : Display.getAvailableDisplayModes()) { if (test.getWidth() == width && test.getHeight() == height && test.isFullscreenCapable()) { matching = test; Arrays.asList(Display.getAvailableDisplayModes())); } else { mode = matching; Display.setDisplayModeAndFullscreen(mode); Display.setDisplayMode(mode);
protected void createContext(AppSettings settings) throws LWJGLException{ DisplayMode displayMode; 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(), ||pixelFormat.getSamples() != pf.getSamples())){ renderer.resetGLObjects(); Display.destroy(); pixelFormatChanged = true; Display.setTitle(settings.getTitle()); Display.setResizable(settings.isResizable()); Display.setDisplayModeAndFullscreen(displayMode); } else { Display.setFullscreen(false); Display.setDisplayMode(displayMode); Display.setFullscreen(settings.isFullscreen()); Display.setIcon(imagesToByteBuffers(settings.getIcons())); Display.setVSyncEnabled(settings.isVSync()); Display.releaseContext(); Display.makeCurrent(); Display.update();
@Override public DisplayMode[] getDisplayModes () { try { org.lwjgl.opengl.DisplayMode[] availableDisplayModes = Display.getAvailableDisplayModes(); DisplayMode[] modes = new DisplayMode[availableDisplayModes.length]; int idx = 0; for (org.lwjgl.opengl.DisplayMode mode : availableDisplayModes) { if (mode.isFullscreenCapable()) { modes[idx++] = new LwjglDisplayMode(mode.getWidth(), mode.getHeight(), mode.getFrequency(), mode.getBitsPerPixel(), mode); } } return modes; } catch (LWJGLException e) { throw new GdxRuntimeException("Couldn't fetch available display modes", e); } }
@Override protected void loop () { boolean wasActive = Display.isActive(); while (!Display.isCloseRequested()) { // notify the app if lose or regain focus (treat said as pause/resume) boolean newActive = Display.isActive(); if (wasActive != newActive) { dispatchEvent(lifecycle, wasActive ? Lifecycle.PAUSE : Lifecycle.RESUME); wasActive = newActive; } ((LWJGLGraphics)graphics()).checkScaleFactor(); // process frame, if we don't need to provide true pausing if (newActive || !config.truePause) processFrame(); Display.update(); // sleep until it's time for the next frame Display.sync(60); } }
public void run () { if (!running || Display.isCloseRequested()) { running = false; stopped(); Display.processMessages(); if (cursor != null || !isWindows) canvas.setCursor(cursor); lastWidth = width; lastHeight = height; Display.setLocation(0, 0); Gdx.gl.glViewport(0, 0, width, height); resize(width, height); graphics.frameId++; listener.render(); Display.update(false); Display.sync(getFrameRate()); } catch (Throwable ex) { exception(ex);
@Override public boolean setFullscreenMode (DisplayMode displayMode) { org.lwjgl.opengl.DisplayMode mode = ((LwjglDisplayMode)displayMode).mode; try { if (!mode.isFullscreenCapable()) { Display.setDisplayMode(mode); } else { Display.setDisplayModeAndFullscreen(mode); } float scaleFactor = Display.getPixelScaleFactor(); config.width = (int)(mode.getWidth() * scaleFactor); config.height = (int)(mode.getHeight() * scaleFactor); if (Gdx.gl != null) Gdx.gl.glViewport(0, 0, config.width, config.height); resize = true; return true; } catch (LWJGLException e) { return false; } }
targetDisplayMode = null; if (fullscreen) { DisplayMode[] modes = Display.getAvailableDisplayModes(); int freq = 0; DisplayMode current = modes[i]; if ((current.getWidth() == width) && (current.getHeight() == height)) { if ((targetDisplayMode == null) || (current.getFrequency() >= freq)) { if ((targetDisplayMode == null) || (current.getBitsPerPixel() > targetDisplayMode.getBitsPerPixel())) { targetDisplayMode = current; this.height = height; Display.setDisplayMode(targetDisplayMode); Display.setFullscreen(fullscreen); if (Display.isCreated()) { initGL(); enterOrtho();
/** * Starts the lwjgl engine and shows a window, where the point clouds are rendered */ public void startEngine() { int width = 800; int height = 600; try { Display.setDisplayMode(new DisplayMode(width, height)); Display.setFullscreen(false); Display.setTitle("Gaalop Visualization Window"); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); System.exit(0); } GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glShadeModel(GL11.GL_SMOOTH); changeSize(width, height); GL11.glDisable(GL11.GL_LIGHTING); // init OpenGL GL11.glViewport(0, 0, width, height); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GLU.gluPerspective((float) 65.0, (float) width / (float) height, (float) 0.1, 100); GL11.glMatrixMode(GL11.GL_MODELVIEW); }
case WINDOWED_FULLSCREEN: System.setProperty("org.lwjgl.opengl.Window.undecorated", "true"); Display.setDisplayMode(Display.getDesktopDisplayMode()); Display.setLocation(0, 0); Display.setFullscreen(false); config.setDisplayModeSetting(displayModeSetting); config.setWindowedFullscreen(true); case WINDOWED: System.setProperty("org.lwjgl.opengl.Window.undecorated", "false"); Display.setDisplayMode(config.getDisplayMode()); Display.setLocation(config.getWindowPosX(), config.getWindowPosY()); Display.setFullscreen(false); Display.setResizable(true); config.setDisplayModeSetting(displayModeSetting); config.setFullscreen(false); glViewport(0, 0, Display.getWidth(), Display.getHeight());
Display.setParent(canvas); } else { boolean displayCreated = false; pixmap.dispose(); Display.setIcon(icons); Display.setTitle(config.title); Display.setResizable(config.resizable); Display.setInitialBackground(config.initialBackgroundColor.r, config.initialBackgroundColor.g, config.initialBackgroundColor.b); Display.setLocation(config.x, config.y); createDisplayPixelFormat(config.useGL30, config.gles30ContextMajorVersion, config.gles30ContextMinorVersion); initiateGL();
Display.setTitle("Terasology" + " | " + "Alpha"); try { BufferedImage icon128 = ImageIO.read(classLoader.getResourceAsStream(root + "gooey_sweet_128.png")); Display.setIcon(new ByteBuffer[]{ TextureUtil.convertToByteBuffer(icon16), TextureUtil.convertToByteBuffer(icon32), try { ContextAttribs ctxAttribs = new ContextAttribs().withDebug(true); Display.create(config.getPixelFormat(), ctxAttribs); Display.create(config.getPixelFormat()); // Create a normal context instead Display.create(config.getPixelFormat()); Display.setVSyncEnabled(config.isVSync()); } catch (LWJGLException e) { throw new RuntimeException("Can not initialize graphics device.", e);
.withProfileCore(true); try { Display.create(new PixelFormat(config.r + config.g + config.b, config.a, config.depth, config.stencil, config.samples), context); } catch (Exception e) { } else { Display .create(new PixelFormat(config.r + config.g + config.b, config.a, config.depth, config.stencil, config.samples)); usingGL30 = false; false); } catch (Exception ex) { Display.destroy(); try { Thread.sleep(200); Display.create(new PixelFormat(0, 16, 8)); if (getDisplayMode().bitsPerPixel == 16) { bufferFormat = new BufferFormat(5, 6, 5, 0, 16, 8, 0, false); Display.destroy(); try { Thread.sleep(200); Display.create(new PixelFormat()); } catch (Exception ex3) { if (!softwareMode && config.allowSoftwareMode) {