-
-
Save void256/498c687c7facef4132e0 to your computer and use it in GitHub Desktop.
jogl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void run(final String[] args, final Callback callback) throws Exception { | |
InputStream input = null; | |
try { | |
input = LoggerShortFormat.class.getClassLoader().getResourceAsStream("logging.properties"); | |
LogManager.getLogManager().readConfiguration(input); | |
} finally { | |
if (input != null) { | |
input.close(); | |
} | |
} | |
if (args.length == 1) { | |
useBatchedRenderer = "batch".equals(args[0]); | |
useBatchedCoreRenderer = "core".equals(args[0]); | |
if (useBatchedCoreRenderer) { | |
useBatchedRenderer = true; | |
} | |
} | |
Runnable run = new Runnable() { | |
@Override | |
public void run() { | |
canvas = new GLCanvas(new GLCapabilities(getProfile(useBatchedCoreRenderer))); | |
canvas.setAutoSwapBufferMode(true); | |
canvas.setSize(CANVAS_WIDTH, CANVAS_HEIGHT); | |
canvas.addGLEventListener(new JOGLNiftyRunner(callback)); | |
final FPSAnimator animator = new FPSAnimator(canvas, FPS, false); | |
frame = new Frame(getCaption(useBatchedRenderer, useBatchedCoreRenderer)); | |
frame.setSize(CANVAS_WIDTH, CANVAS_HEIGHT); | |
frame.add(canvas); | |
frame.setVisible(true); | |
frame.addWindowListener(new WindowAdapter() { | |
public void windowClosing(WindowEvent e) { | |
animator.stop(); | |
frame.remove(canvas); | |
System.exit(0); | |
} | |
}); | |
animator.start(); | |
} | |
}; | |
SwingUtilities.invokeAndWait(run); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment