com.jogamp.newt.event.WindowEvent Java Examples
The following examples show how to use
com.jogamp.newt.event.WindowEvent.
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: 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 #3
Source File: CubeSample2.java From MeteoInfo with GNU Lesser General Public License v3.0 | 6 votes |
public CubeSample2() { GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2)); glu = new GLU(); glWindow = GLWindow.create(caps); glWindow.setTitle("Cube demo (Newt)"); glWindow.setSize(300, 300); glWindow.addGLEventListener(this); glWindow.addWindowListener(new WindowAdapter() { @Override public void windowDestroyed(WindowEvent arg0) { System.exit(0); } }); glWindow.addMouseListener(this); glWindow.addKeyListener(this); //animator = new FPSAnimator(30); animator = new FPSAnimator(glWindow, 30, false); animator.add(glWindow); animator.start(); animator.pause(); glWindow.setVisible(true); }
Example #4
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 #5
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 #6
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 #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: 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 #9
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 #10
Source File: Renderer.java From jaamsim with Apache License 2.0 | 5 votes |
@Override public void windowGainedFocus(WindowEvent arg0) { WindowInteractionListener listener = getListener(); if (listener != null) { listener.windowGainedFocus(); } }
Example #11
Source File: Renderer.java From jaamsim with Apache License 2.0 | 4 votes |
@Override public void windowResized(WindowEvent arg0) { }
Example #12
Source File: Renderer.java From jaamsim with Apache License 2.0 | 4 votes |
@Override public void windowMoved(WindowEvent arg0) { }
Example #13
Source File: Renderer.java From jaamsim with Apache License 2.0 | 4 votes |
@Override public void windowLostFocus(WindowEvent arg0) { }
Example #14
Source File: Renderer.java From jaamsim with Apache License 2.0 | 4 votes |
@Override public void windowDestroyed(WindowEvent arg0) { }
Example #15
Source File: Renderer.java From jaamsim with Apache License 2.0 | 4 votes |
@Override public void windowDestroyNotify(WindowEvent we) { windowCleanup(windowID); }
Example #16
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 #17
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 #18
Source File: ClearGLVolumeRenderer.java From clearvolume with GNU Lesser General Public License v3.0 | 4 votes |
/** * Constructs an instance of the JoglPBOVolumeRenderer class given a window * name, its dimensions, number of bytes-per-voxel, max texture width, height * and number of render layers. * * @param pWindowName * window name * @param pWindowWidth * window width * @param pWindowHeight * window height * @param pNativeTypeEnum * native type * @param pMaxRenderWidth * max render width * @param pMaxRenderHeight * max render height * @param pNumberOfRenderLayers * number of render layers * @param pUseInCanvas * if true, this Renderer will not be displayed in a window of it's * own, but must be embedded in a GUI as Canvas. */ @SuppressWarnings("unchecked") public ClearGLVolumeRenderer(final String pWindowName, final int pWindowWidth, final int pWindowHeight, final NativeTypeEnum pNativeTypeEnum, final int pMaxRenderWidth, final int pMaxRenderHeight, final int pNumberOfRenderLayers, final boolean pUseInCanvas) { super(pNumberOfRenderLayers); mViewportWidth = pWindowWidth; mViewportHeight = pWindowHeight; mMaxRenderWidth = pMaxRenderWidth; mMaxRenderHeight = pMaxRenderHeight; mRenderWidth = min(pMaxRenderWidth, pWindowWidth); mRenderHeight = min(pMaxRenderHeight, pWindowHeight); mWindowName = pWindowName; mLastWindowWidth = pWindowWidth; mLastWindowHeight = pWindowHeight; setNumberOfRenderLayers(pNumberOfRenderLayers); mLayerTextures = new GLTexture[getNumberOfRenderLayers()]; resetBrightnessAndGammaAndTransferFunctionRanges(); resetRotationTranslation(); setNativeType(pNativeTypeEnum); // addOverlay(new BoxOverlay(0, .2f, false, "box_plain")); addOverlay(new BoxOverlay(10, 1.f, true, "box")); mClearGLWindow = new ClearGLWindow(pWindowName, pWindowWidth, pWindowHeight, this); mClearGLWindow.setFPS(60); mClearGLWindow.start(); if (pUseInCanvas) { mNewtCanvasAWT = mClearGLWindow.getNewtCanvasAWT(); mNewtCanvasAWT.setShallUseOffscreenLayer(true); } else { mNewtCanvasAWT = null; } // Initialize the mouse controls final MouseControl lMouseControl = new MouseControl(this); mClearGLWindow.addMouseListener(lMouseControl); // Initialize the keyboard controls final KeyboardControl lKeyboardControl = new KeyboardControl(this, lMouseControl); mClearGLWindow.addKeyListener(lKeyboardControl); mClearGLWindow.addWindowListener(new WindowAdapter() { @Override public void windowDestroyNotify(final WindowEvent pE) { super.windowDestroyNotify(pE); }; }); setVideoRecorder(new BasicVideoRecorder(new File(SystemUtils.USER_HOME, "Videos/ClearVolume"))); }