glcanvas = new GLCanvas(glcapabilities); glcanvas.addGLEventListener(new GLEventListener()
glcanvas = new GLCanvas(glcapabilities); glcanvas.addGLEventListener(new GLEventListener()
glcanvas = new GLCanvas(glcapabilities);
glcanvas = new GLCanvas(glcapabilities);
public GraphCanvas() { super(); glCanvas = new GLCanvas(getCaps()); super.initDrawable(glCanvas); // glCanvas.setMinimumSize(new Dimension(0, 0)); //Fix Canvas resize Issue //Basic init graphComponent = (Component) glCanvas; // graphComponent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); //False lets the components appear on top of the canvas JPopupMenu.setDefaultLightWeightPopupEnabled(false); ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); }
public static void main(String... args) { // create the cursor Toolkit t = Toolkit.getDefaultToolkit(); Image i = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); Cursor noCursor = t.createCustomCursor(i, new Point(0, 0), "none"); // try it with a normal frame Frame f = new Frame(); // create the GLCanvas and add it to the frame GLCanvas canvas = new GLCanvas(); frame.add(canvas); f.setCursor(noCursor); f.setSize(400, 200); f.setVisible(true); }
public GlCostDemo() { super("GlCostDemo"); GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); caps.setDoubleBuffered(true); System.out.println(caps); GLCanvas canvas = new GLCanvas(caps); canvas.addGLEventListener(this); this.add(canvas); }
/** * Creates a {@code Component} that is also a {@code GLAutoDrawable}. This is * where all the drawing takes place. The advantage of a {@code GLCanvas} is * that it is faster, but a {@code GLJPanel} is more portable. The component * should also be disabled so that it does not receive events that should be * sent to the {@code drawableComponent}. A {@code GLCanvas} is a heavyweight * component and on some platforms will not pass through mouse events even * though it is disabled. A {@code GLJPanel} supports this better. */ protected GLAutoDrawable createGLComponent(GLCapabilitiesImmutable capabilities, GLContext shareWith) { GLCanvas canvas = new GLCanvas(capabilities); if (shareWith != null) { canvas.setSharedContext(shareWith); } canvas.setEnabled(false); chosenCapabilities = (GLCapabilitiesImmutable) capabilities.cloneMutable(); return canvas; }
/** * @return canvas with GL2 profile. */ private static GLCanvas createCanvas() { // create a profile, in this case OpenGL 2 or later GLProfile profile = GLProfile.get(GLProfile.GL2); // configure context GLCapabilities capabilities = new GLCapabilities(profile); // setup z-buffer capabilities.setDepthBits(16); // for anti-aliasing // FIXME enabling sample buffers on dual screen ubuntu cause problems... // capabilities.setSampleBuffers(true); // capabilities.setNumSamples(2); // initialize a GLDrawable of your choice return new GLCanvas(capabilities); }
public void run() { System.out.println("main:run"); GLCanvas canvas = new GLCanvas(); GLJPanel jpanel = new GLJPanel(); canvas.addGLEventListener(new Guts("GLCanvas")); jpanel.addGLEventListener(new Guts("GLJPanel")); makeFrame(canvas,"JoglDemo: GLCanvas"); makeFrame(jpanel,"JoglDemo: GLJPanel"); } });
/** * Creates a {@code Component} that is also a {@code GLAutoDrawable}. This is * where all the drawing takes place. The advantage of a {@code GLCanvas} is * that it is faster, but a {@code GLJPanel} is more portable. The component * should also be disabled so that it does not receive events that should be * sent to the {@code drawableComponent}. A {@code GLCanvas} is a heavyweight * component and on some platforms will not pass through mouse events even * though it is disabled. A {@code GLJPanel} supports this better. */ protected GLAutoDrawable createGLComponent(GLCapabilitiesImmutable capabilities, GLContext shareWith) { GLCanvas canvas = new GLCanvas(capabilities); if (shareWith != null) { canvas.setSharedContext(shareWith); } canvas.setEnabled(false); chosenCapabilities = (GLCapabilitiesImmutable) capabilities.cloneMutable(); return canvas; }
public static Component createGLCanvas(OTFVisConfigGroup otfVisConfig) { //turn off HiDPI uiScaling in Windows (issue MATSIM-875) if (System.getProperty("os.name").startsWith("Windows")) { System.setProperty("sun.java2d.uiScale", "1.0"); } GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2)); if (otfVisConfig.isMapOverlayMode()) { caps.setBackgroundOpaque(false); // A GLJPanel is an OpenGL component which is "more Swing compatible" than a GLCanvas. // The JOGL doc says the tradeoff is that it is slower than a GLCanvas. // We use it if we want to put map tiles behind the agent drawer, because it can be made translucent! GLJPanel glJPanel = new GLJPanel(caps); glJPanel.setOpaque(false); // So that the map shines through return glJPanel; } else { // This is the default JOGL component. JOGL doc recommends using it if you do not need a GLJPanel. return new GLCanvas(caps); } }
/** * @return */ public static GLCanvas createCanvas() { // create a profile, in this case OpenGL 2 or later GLProfile profile = GLProfile.get(GLProfile.GL2); // configure context GLCapabilities capabilities = new GLCapabilities(profile); // setup z-buffer capabilities.setDepthBits(16); // for anti-aliasing // FIXME enabling sample buffers on dual screen ubuntu cause problems... // capabilities.setSampleBuffers(true); // capabilities.setNumSamples(2); // initialize a GLDrawable of your choice GLCanvas canvas = new GLCanvas(capabilities); return canvas; }
Runnable r = new Runnable() { public void run() { String wasErase = System.setProperty("sun.awt.noerasebackground", "true"); canvas = new GLCanvas(caps); if (shareWith != null) { ((GLCanvas)canvas).setSharedContext(shareWith); } ((GLCanvas)canvas).addGLEventListener(eventListener); if (fullScreen) { canvas.setSize(getSize()); needInitialResize = false; } else { canvas.setSize(1, 1); // or we do not get a GLContext needInitialResize = true; } getContentPane().add(canvas); canvas.setVisible(true); if (wasErase != null) { System.setProperty("sun.awt.noerasebackground", wasErase); } else { System.clearProperty("sun.awt.noerasebackground"); } }};
/** * Creates a new GltfViewerJogl */ public GltfViewerJogl() { GLProfile profile = getGLProfile(); logger.config("GLProfile: " + profile); GLCapabilities capabilities = new GLCapabilities(profile); capabilities.setNumSamples(2); capabilities.setSampleBuffers(true); glComponent = new GLCanvas(capabilities); glComponent.addGLEventListener(glEventListener); // Without setting the minimum size, the canvas cannot // be resized when it is embedded in a JSplitPane glComponent.setMinimumSize(new Dimension(10, 10)); glContext = new GlContextJogl(); }
/** * @return */ public static GLCanvas createCanvas() { // create a profile, in this case OpenGL 2 or later GLProfile profile = GLProfile.get(GLProfile.GL2); // configure context GLCapabilities capabilities = new GLCapabilities(profile); // setup z-buffer capabilities.setDepthBits(16); // for anti-aliasing capabilities.setSampleBuffers(true); capabilities.setNumSamples(2); // initialize a GLDrawable of your choice GLCanvas canvas = new GLCanvas(capabilities); return canvas; }
JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); GLCanvas canvas = new GLCanvas(); canvas.addGLEventListener(new VBOTest()); frame.add(canvas);
GLCanvas canvas = new GLCanvas(); canvas.addGLEventListener(new HelloWorld()); frame.add(canvas);
public static void main(String[] args) { Frame frame = new Frame("Delaunay Triangulation Example"); frame.setResizable(false); GLCapabilities caps = new GLCapabilities(GLProfile.get("GL2")); caps.setSampleBuffers(true); caps.setNumSamples(8); GLCanvas canvas = new GLCanvas(caps); DelaunayTriangulationExample ex = new DelaunayTriangulationExample(); MouseListener lister = ex; canvas.addGLEventListener(ex); canvas.setPreferredSize(DIMENSION); canvas.addMouseListener(lister); frame.add(canvas); final FPSAnimator animator = new FPSAnimator(canvas, 25); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { new Thread(new Runnable() { public void run() { animator.stop(); System.exit(0); } }).start(); } }); frame.setVisible(true); frame.pack(); animator.start(); }
caps2.setDoubleBuffered(true); caps2.setStereo(false); c = new GLCanvas(caps2); c.setAutoSwapBufferMode(true); c.addGLEventListener(this);