protected void loop() throws Exception { while (isShowing()) { if (!paused) { buffer.clear(java.awt.Color.BLACK); world.renderScene(buffer); world.draw(buffer); camera.performMovement(); buffer.update(); buffer.display(canvas.getGraphics()); canvas.repaint(); if (System.currentTimeMillis() - startTime >= delay) { startTime = System.currentTimeMillis(); wb.update(); } } this.requestFocus(); } buffer.disableRenderer(IRenderer.RENDERER_OPENGL); buffer.dispose(); dispose(); System.exit(0); }
private void initBuffer() { buffer = new FrameBuffer(windowx, windowy, FrameBuffer.SAMPLINGMODE_HARDWARE_ONLY); buffer.optimizeBufferAccess(); buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE); buffer.enableRenderer(IRenderer.RENDERER_OPENGL); }