Java Code Examples for com.jogamp.opengl.util.Animator#start()
The following examples show how to use
com.jogamp.opengl.util.Animator#start() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HelloGlobe.java From CPE552-Java with GNU General Public License v3.0 | 6 votes |
private void setup() { GLProfile glProfile = GLProfile.get(GLProfile.GL3); GLCapabilities glCapabilities = new GLCapabilities(glProfile); window = GLWindow.create(glCapabilities); window.setTitle("Hello Globe"); window.setSize(1024, 768); window.setContextCreationFlags(GLContext.CTX_OPTION_DEBUG); window.setVisible(true); window.addGLEventListener(this); window.addKeyListener(this); animator = new Animator(window); animator.start(); window.addWindowListener(new WindowAdapter() { @Override public void windowDestroyed(WindowEvent e) { animator.stop(); System.exit(1); } }); }
Example 2
Source File: Input_into_rendering.java From hello-triangle with MIT License | 6 votes |
private void setup() { GLProfile glProfile = GLProfile.get(GLProfile.GL3); GLCapabilities glCapabilities = new GLCapabilities(glProfile); window = GLWindow.create(glCapabilities); window.setTitle("Input into rendering"); window.setSize(1024, 768); window.addGLEventListener(this); window.addKeyListener(this); window.setVisible(true); animator = new Animator(window); animator.start(); window.addWindowListener(new WindowAdapter() { @Override public void windowDestroyed(WindowEvent e) { animator.stop(); System.exit(1); } }); }
Example 3
Source File: HelloTriangle.java From hello-triangle with MIT License | 6 votes |
private void setup() { GLProfile glProfile = GLProfile.get(GLProfile.GL3); GLCapabilities glCapabilities = new GLCapabilities(glProfile); window = GLWindow.create(glCapabilities); window.setTitle("Hello Triangle (enhanced)"); window.setSize(1024, 768); window.setVisible(true); window.addGLEventListener(this); window.addKeyListener(this); animator = new Animator(window); animator.start(); window.addWindowListener(new WindowAdapter() { @Override public void windowDestroyed(WindowEvent e) { animator.stop(); System.exit(1); } }); }
Example 4
Source File: GL_injection.java From hello-triangle with MIT License | 5 votes |
private void setup() { GLProfile glProfile = GLProfile.get(GLProfile.GL3); GLCapabilities glCapabilities = new GLCapabilities(glProfile); window = GLWindow.create(glCapabilities); window.setTitle("gl injection"); window.setSize(1024, 768); window.addGLEventListener(this); window.addKeyListener(this); window.setAutoSwapBufferMode(false); window.setVisible(true); animator = new Animator(window); animator.start(); window.addWindowListener(new WindowAdapter() { @Override public void windowDestroyed(WindowEvent e) { animator.stop(); System.exit(1); } }); }
Example 5
Source File: UINewtDemo01.java From jogl-samples with MIT License | 5 votes |
public static void main(final String[] args) { final GLProfile glp = GLProfile.getGL2ES2(); final GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(4); caps.setSampleBuffers(true); caps.setNumSamples(4); System.out.println("Requested: " + caps); final GLWindow window = GLWindow.create(caps); window.setPosition(10, 10); window.setSize(800, 400); window.setTitle("GPU UI Newt Demo 01"); final RenderState rs = RenderState.createRenderState(SVertex.factory()); final UIGLListener01 uiGLListener = new UIGLListener01 (0, rs, DEBUG, TRACE); uiGLListener.attachInputListenerTo(window); window.addGLEventListener(uiGLListener); window.setVisible(true); final Animator animator = new Animator(); animator.setUpdateFPSFrames(60, System.err); animator.add(window); window.addKeyListener(new KeyAdapter() { public void keyPressed(final KeyEvent arg0) { if(arg0.getKeyCode() == KeyEvent.VK_F4) { window.destroy(); } } }); window.addWindowListener(new WindowAdapter() { public void windowDestroyed(final WindowEvent e) { animator.stop(); } }); animator.start(); }
Example 6
Source File: HelloTriangleSimple.java From hello-triangle with MIT License | 5 votes |
private void setup() { GLProfile glProfile = GLProfile.get(GLProfile.GL3); GLCapabilities glCapabilities = new GLCapabilities(glProfile); window = GLWindow.create(glCapabilities); window.setTitle("Hello Triangle (simple)"); window.setSize(1024, 768); window.setVisible(true); window.addGLEventListener(this); window.addKeyListener(this); animator = new Animator(window); animator.start(); window.addWindowListener(new WindowAdapter() { @Override public void windowDestroyed(WindowEvent e) { animator.stop(); System.exit(1); } }); }
Example 7
Source File: HelloTexture.java From hello-triangle with MIT License | 5 votes |
private void setup() { GLProfile glProfile = GLProfile.get(GLProfile.GL3); GLCapabilities glCapabilities = new GLCapabilities(glProfile); window = GLWindow.create(glCapabilities); window.setTitle("Hello Texture"); window.setSize(1024, 768); window.setVisible(true); window.addGLEventListener(this); window.addKeyListener(this); animator = new Animator(); animator.add(window); animator.start(); window.addWindowListener(new WindowAdapter() { @Override public void windowDestroyed(WindowEvent e) { animator.stop(); System.exit(1); } }); }
Example 8
Source File: HelloTriangle.java From CPE552-Java with GNU General Public License v3.0 | 5 votes |
private void setup() { GLProfile glProfile = GLProfile.get(GLProfile.GL3); GLCapabilities glCapabilities = new GLCapabilities(glProfile); window = GLWindow.create(glCapabilities); window.setTitle("Hello Triangle (enhanced)"); window.setSize(1024, 768); window.addGLEventListener(this); window.addKeyListener(this); window.setContextCreationFlags(GLContext.CTX_OPTION_DEBUG); window.setVisible(true); animator = new Animator(window); animator.start(); window.addWindowListener(new WindowAdapter() { @Override public void windowDestroyed(WindowEvent e) { animator.stop(); System.exit(1); } }); }
Example 9
Source File: HelloTriangleSimple.java From hello-triangle with MIT License | 5 votes |
private void setup() { GLProfile glProfile = GLProfile.get(GLProfile.GL3); GLCapabilities glCapabilities = new GLCapabilities(glProfile); window = GLWindow.create(glCapabilities); window.setTitle("Hello Triangle (enhanced)"); window.setSize(1024, 768); window.setContextCreationFlags(GLContext.CTX_OPTION_DEBUG); window.setVisible(true); window.addGLEventListener(this); window.addKeyListener(this); animator = new Animator(window); animator.start(); window.addWindowListener(new WindowAdapter() { @Override public void windowDestroyed(WindowEvent e) { animator.stop(); System.exit(1); } }); }
Example 10
Source File: HelloGlobe.java From hello-triangle with MIT License | 5 votes |
private void setup() { GLProfile glProfile = GLProfile.get(GLProfile.GL3); GLCapabilities glCapabilities = new GLCapabilities(glProfile); window = GLWindow.create(glCapabilities); window.setTitle("Hello Globe"); window.setSize(1024, 768); window.setContextCreationFlags(GLContext.CTX_OPTION_DEBUG); window.setVisible(true); window.addGLEventListener(this); window.addKeyListener(this); animator = new Animator(window); animator.start(); window.addWindowListener(new WindowAdapter() { @Override public void windowDestroyed(WindowEvent e) { animator.stop(); System.exit(1); } }); }
Example 11
Source File: HelloTriangle.java From hello-triangle with MIT License | 5 votes |
private void setup() { GLProfile glProfile = GLProfile.get(GLProfile.GL3); GLCapabilities glCapabilities = new GLCapabilities(glProfile); window = GLWindow.create(glCapabilities); window.setTitle("Hello Triangle (enhanced)"); window.setSize(1024, 768); window.addGLEventListener(this); window.addKeyListener(this); window.setContextCreationFlags(GLContext.CTX_OPTION_DEBUG); window.setVisible(true); animator = new Animator(window); animator.start(); window.addWindowListener(new WindowAdapter() { @Override public void windowDestroyed(WindowEvent e) { animator.stop(); System.exit(1); } }); }
Example 12
Source File: HelloTriangleSimple.java From CPE552-Java with GNU General Public License v3.0 | 5 votes |
private void setup() { GLProfile glProfile = GLProfile.get(GLProfile.GL3); GLCapabilities glCapabilities = new GLCapabilities(glProfile); window = GLWindow.create(glCapabilities); window.setTitle("Hello Triangle (enhanced)"); window.setSize(1024, 768); window.setContextCreationFlags(GLContext.CTX_OPTION_DEBUG); window.setVisible(true); window.addGLEventListener(this); window.addKeyListener(this); animator = new Animator(window); animator.start(); window.addWindowListener(new WindowAdapter() { @Override public void windowDestroyed(WindowEvent e) { animator.stop(); System.exit(1); } }); }
Example 13
Source File: NBodyVisualizer.java From gpu-nbody with MIT License | 4 votes |
/** * Creates a new JOCLSimpleGL3 sample. * * @param capabilities * The GL capabilities */ public NBodyVisualizer(final GLCapabilities capabilities) { glComponent = new GLCanvas(capabilities); glComponent.setFocusable(true); glComponent.addGLEventListener(this); // Initialize the mouse and keyboard controls final MouseControl mouseControl = new MouseControl(); glComponent.addMouseMotionListener(mouseControl); glComponent.addMouseWheelListener(mouseControl); final KeyboardControl keyboardControl = new KeyboardControl(); glComponent.addKeyListener(keyboardControl); setFullscreen(); updateModelviewMatrix(); // Create and start an animator animator = new Animator(glComponent); animator.start(); // Create the simulation // simulation = new GPUBarnesHutNBodySimulation(Mode.GL_INTEROP, 2048 * 16, new SerializedUniverseGenerator("universes/sphericaluniverse1.universe")); // simulation = new GPUBarnesHutNBodySimulation(Mode.GL_INTEROP, 2048 * 16, new SerializedUniverseGenerator("universes/montecarlouniverse1.universe")); // simulation = new GPUBarnesHutNBodySimulation(Mode.GL_INTEROP, 2048 * 16, new RotatingDiskGalaxyGenerator(3.5f, 25, 0)); simulation = new GPUBarnesHutNBodySimulation(Mode.GL_INTEROP, 2048 * 16, new RotatingDiskGalaxyGenerator(3.5f, 1, 1)); // simulation = new GPUBarnesHutNBodySimulation(Mode.GL_INTEROP, 2048 * 16, new SphericalUniverseGenerator()); // simulation = new GPUBarnesHutNBodySimulation(Mode.GL_INTEROP, 2048 * 16, new LonLatSphericalUniverseGenerator()); // simulation = new GPUBarnesHutNBodySimulation(Mode.GL_INTEROP, 2048 * 16, new RandomCubicUniverseGenerator(5)); // simulation = new GPUBarnesHutNBodySimulation(Mode.GL_INTEROP, 2048 * 16, new MonteCarloSphericalUniverseGenerator()); // simulation = new GpuNBodySimulation(Mode.GL_INTEROP, 2048 * 8, new LonLatSphericalUniverseGenerator()); // simulation = new GpuNBodySimulation(Mode.GL_INTEROP, 2048, new PlummerUniverseGenerator()); // simulation = new GpuNBodySimulation(Mode.GL_INTEROP, 128, new SphericalUniverseGenerator()); // Create the main frame frame = new JFrame("NBody Simulation"); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(final WindowEvent e) { runExit(); } }); frame.setLayout(new BorderLayout()); frame.add(glComponent, BorderLayout.CENTER); frame.setUndecorated(true); frame.setExtendedState(JFrame.MAXIMIZED_BOTH); frame.setVisible(true); frame.setLocationRelativeTo(null); glComponent.requestFocus(); }
Example 14
Source File: JCudaDriverVolumeRendererJOGL.java From jcuda-samples with MIT License | 4 votes |
/** * Creates a new JCudaTextureSample that displays the given volume * data, which has the specified size. * * @param volumeData The volume data * @param sizeX The size of the data set in X direction * @param sizeY The size of the data set in Y direction * @param sizeZ The size of the data set in Z direction */ public JCudaDriverVolumeRendererJOGL(GLCapabilities capabilities, byte volumeData[], int sizeX, int sizeY, int sizeZ) { this.simpleInteraction = new SimpleInteraction(); h_volume = volumeData; volumeSize.x = sizeX; volumeSize.y = sizeY; volumeSize.z = sizeZ; width = 800; height = 800; // Initialize the GL component glComponent = new GLCanvas(capabilities); glComponent.addGLEventListener(this); // Initialize the mouse controls MouseControl mouseControl = simpleInteraction.getMouseControl(); glComponent.addMouseMotionListener(mouseControl); glComponent.addMouseWheelListener(mouseControl); // Create the main frame frame = new JFrame("JCuda 3D texture volume rendering sample"); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { runExit(); } }); frame.setLayout(new BorderLayout()); glComponent.setPreferredSize(new Dimension(width, height)); frame.add(glComponent, BorderLayout.CENTER); frame.add(createControlPanel(), BorderLayout.SOUTH); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); // Create and start the animator animator = new Animator(glComponent); animator.setRunAsFastAsPossible(true); animator.start(); }
Example 15
Source File: JCudaDriverSimpleJOGL.java From jcuda-samples with MIT License | 4 votes |
/** * Creates a new JCudaDriverSimpleJOGL. * * @param The JOGL OpenGL capabilities */ public JCudaDriverSimpleJOGL(GLCapabilities capabilities) { simpleInteraction = new SimpleInteraction(); // Initialize the GL component and the animator GLCanvas glComponent = new GLCanvas(capabilities); glComponent.setFocusable(true); glComponent.addGLEventListener(this); // Initialize the mouse and keyboard controls MouseControl mouseControl = simpleInteraction.getMouseControl(); glComponent.addMouseMotionListener(mouseControl); glComponent.addMouseWheelListener(mouseControl); KeyboardControl keyboardControl = new KeyboardControl(); glComponent.addKeyListener(keyboardControl); // Create the main frame frame = new JFrame("JCuda / JOGL interaction sample"); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { runExit(); } }); frame.setLayout(new BorderLayout()); glComponent.setPreferredSize(new Dimension(800, 800)); frame.add(glComponent, BorderLayout.CENTER); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); glComponent.requestFocus(); // Create and start the animator animator = new Animator(glComponent); animator.setRunAsFastAsPossible(false); animator.start(); }
Example 16
Source File: GPURegionNewtDemo.java From jogl-samples with MIT License | 4 votes |
public static void main(final String[] args) { int width = 800, height = 400; int x = 10, y = 10; if( 0 != args.length ) { SceneMSAASamples = 0; GraphMSAASamples = 0; GraphVBAASamples = 0; GraphUseWeight = false; for(int i=0; i<args.length; i++) { if(args[i].equals("-smsaa")) { i++; SceneMSAASamples = MiscUtils.atoi(args[i], SceneMSAASamples); } else if(args[i].equals("-gmsaa")) { i++; GraphMSAASamples = MiscUtils.atoi(args[i], GraphMSAASamples); GraphVBAASamples = 0; } else if(args[i].equals("-gvbaa")) { i++; GraphMSAASamples = 0; GraphVBAASamples = MiscUtils.atoi(args[i], GraphVBAASamples); } else if(args[i].equals("-gweight")) { GraphUseWeight = true; } else if(args[i].equals("-width")) { i++; width = MiscUtils.atoi(args[i], width); } else if(args[i].equals("-height")) { i++; height = MiscUtils.atoi(args[i], height); } else if(args[i].equals("-x")) { i++; x = MiscUtils.atoi(args[i], x); } else if(args[i].equals("-y")) { i++; y = MiscUtils.atoi(args[i], y); } } } System.err.println("Desired win size "+width+"x"+height); System.err.println("Desired win pos "+x+"/"+y); System.err.println("Scene MSAA Samples "+SceneMSAASamples); System.err.println("Graph MSAA Samples"+GraphMSAASamples); System.err.println("Graph VBAA Samples "+GraphVBAASamples); System.err.println("Graph Weight Mode "+GraphUseWeight); final GLProfile glp = GLProfile.getGL2ES2(); final GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(4); if( SceneMSAASamples > 0 ) { caps.setSampleBuffers(true); caps.setNumSamples(SceneMSAASamples); } System.out.println("Requested: " + caps); int rmode = GraphUseWeight ? Region.VARWEIGHT_RENDERING_BIT : 0; int sampleCount = 0; if( GraphVBAASamples > 0 ) { rmode |= Region.VBAA_RENDERING_BIT; sampleCount += GraphVBAASamples; } else if( GraphMSAASamples > 0 ) { rmode |= Region.MSAA_RENDERING_BIT; sampleCount += GraphMSAASamples; } final GLWindow window = GLWindow.create(caps); window.setPosition(x, y); window.setSize(width, height); window.setTitle("GPU Curve Region Newt Demo - graph[vbaa"+GraphVBAASamples+" msaa"+GraphMSAASamples+"], msaa "+SceneMSAASamples); final RenderState rs = RenderState.createRenderState(SVertex.factory()); final GPURegionGLListener01 regionGLListener = new GPURegionGLListener01 (rs, rmode, sampleCount, DEBUG, TRACE); regionGLListener.attachInputListenerTo(window); window.addGLEventListener(regionGLListener); window.setVisible(true); //FPSAnimator animator = new FPSAnimator(60); final Animator animator = new Animator(); animator.setUpdateFPSFrames(60, System.err); animator.add(window); window.addKeyListener(new KeyAdapter() { public void keyPressed(final KeyEvent arg0) { if(arg0.getKeyCode() == KeyEvent.VK_F4) { window.destroy(); } } }); window.addWindowListener(new WindowAdapter() { public void windowDestroyed(final WindowEvent e) { animator.stop(); } }); animator.start(); }
Example 17
Source File: GPUTextNewtDemo.java From jogl-samples with MIT License | 4 votes |
public static void main(final String[] args) { int width = 800, height = 400; int x = 10, y = 10; if( 0 != args.length ) { SceneMSAASamples = 0; GraphMSAASamples = 0; GraphVBAASamples = 0; for(int i=0; i<args.length; i++) { if(args[i].equals("-smsaa")) { i++; SceneMSAASamples = MiscUtils.atoi(args[i], SceneMSAASamples); } else if(args[i].equals("-gmsaa")) { i++; GraphMSAASamples = MiscUtils.atoi(args[i], GraphMSAASamples); GraphVBAASamples = 0; } else if(args[i].equals("-gvbaa")) { i++; GraphMSAASamples = 0; GraphVBAASamples = MiscUtils.atoi(args[i], GraphVBAASamples); } else if(args[i].equals("-width")) { i++; width = MiscUtils.atoi(args[i], width); } else if(args[i].equals("-height")) { i++; height = MiscUtils.atoi(args[i], height); } else if(args[i].equals("-x")) { i++; x = MiscUtils.atoi(args[i], x); } else if(args[i].equals("-y")) { i++; y = MiscUtils.atoi(args[i], y); } } } System.err.println("Desired win size "+width+"x"+height); System.err.println("Desired win pos "+x+"/"+y); System.err.println("Scene MSAA Samples "+SceneMSAASamples); System.err.println("Graph MSAA Samples "+GraphMSAASamples); System.err.println("Graph VBAA Samples "+GraphVBAASamples); final GLProfile glp = GLProfile.getGL2ES2(); final GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(4); if( SceneMSAASamples > 0 ) { caps.setSampleBuffers(true); caps.setNumSamples(SceneMSAASamples); } System.out.println("Requested: " + caps); int rmode = 0; // Region.VARIABLE_CURVE_WEIGHT_BIT; int sampleCount = 0; if( GraphVBAASamples > 0 ) { rmode |= Region.VBAA_RENDERING_BIT; sampleCount += GraphVBAASamples; } else if( GraphMSAASamples > 0 ) { rmode |= Region.MSAA_RENDERING_BIT; sampleCount += GraphMSAASamples; } final GLWindow window = GLWindow.create(caps); window.setPosition(x, y); window.setSize(width, height); window.setTitle("GPU Text Newt Demo - graph[vbaa"+GraphVBAASamples+" msaa"+GraphMSAASamples+"], msaa "+SceneMSAASamples); final RenderState rs = RenderState.createRenderState(SVertex.factory()); final GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(rs, rmode, sampleCount, true, DEBUG, TRACE); // ((TextRenderer)textGLListener.getRenderer()).setCacheLimit(32); window.addGLEventListener(textGLListener); window.setVisible(true); // FPSAnimator animator = new FPSAnimator(60); final Animator animator = new Animator(); animator.setUpdateFPSFrames(60, System.err); animator.add(window); window.addKeyListener(new KeyAdapter() { public void keyPressed(final KeyEvent arg0) { if(arg0.getKeyCode() == KeyEvent.VK_F4) { window.destroy(); } } }); window.addWindowListener(new WindowAdapter() { public void windowDestroyed(final WindowEvent e) { animator.stop(); } }); animator.start(); }
Example 18
Source File: TestTextRendererNEWT00.java From jogl-samples with MIT License | 4 votes |
public void testImpl(final int sceneMSAASamples, final int graphMSAASamples, final int graphVBAASamples) throws InterruptedException { final GLProfile glp = GLProfile.get(GLProfile.GL2ES2); final GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(4); if( 0 < sceneMSAASamples ) { caps.setSampleBuffers(true); caps.setNumSamples(sceneMSAASamples); } System.err.println("Requested: "+caps+", graph[msaaSamples "+graphMSAASamples+", vbaaSamples "+graphVBAASamples+"]"); final GLWindow window = createWindow("text-gvbaa"+graphVBAASamples+"-gmsaa"+graphMSAASamples+"-smsaa"+sceneMSAASamples, caps, 1024, 640); window.display(); System.err.println("Chosen: "+window.getChosenGLCapabilities()); if( WaitStartEnd ) { JunitTracer.waitForKey("Start"); } final RenderState rs = RenderState.createRenderState(SVertex.factory()); final int renderModes, sampleCount; if( graphVBAASamples > 0 ) { renderModes = Region.VBAA_RENDERING_BIT; sampleCount = graphVBAASamples; } else if ( graphMSAASamples > 0 ) { renderModes = Region.MSAA_RENDERING_BIT; sampleCount = graphMSAASamples; } else { renderModes = 0; sampleCount = 0; } final TextRendererGLEL textGLListener = new TextRendererGLEL(rs, renderModes, sampleCount); System.err.println(textGLListener.getFontInfo()); window.addGLEventListener(textGLListener); final Animator anim = new Animator(); anim.add(window); anim.start(); anim.setUpdateFPSFrames(60, null); sleep(); window.invoke(true, new GLRunnable() { @Override public boolean run(final GLAutoDrawable drawable) { try { textGLListener.printScreen(renderModes, drawable, "./", "TestTextRendererNEWT00-snap"+screenshot_num, false); screenshot_num++; } catch (final Exception e) { e.printStackTrace(); } return true; } }); anim.stop(); if( WaitStartEnd ) { JunitTracer.waitForKey("Stop"); } destroyWindow(window); }