Search in sources :

Example 1 with GLJPanel

use of com.jogamp.opengl.awt.GLJPanel in project Universal-G-Code-Sender by winder.

the class Visualizer2TopComponent method makeWindow.

private GLJPanel makeWindow() {
    GLCapabilities glCaps = new GLCapabilities(null);
    final GLJPanel p = new GLJPanel(glCaps);
    GcodeRenderer renderer = Lookup.getDefault().lookup(GcodeRenderer.class);
    if (renderer == null) {
        throw new IllegalArgumentException("Failed to access GcodeRenderer.");
    }
    FPSAnimator animator = new FPSAnimator(p, 15);
    this.rih = new RendererInputHandler(renderer, animator, new VisualizerPopupMenu(backend, renderer), backend.getSettings());
    Preferences pref = NbPreferences.forModule(VisualizerOptionsPanel.class);
    pref.addPreferenceChangeListener(this.rih);
    File f = (backend.getProcessedGcodeFile() != null) ? backend.getProcessedGcodeFile() : backend.getGcodeFile();
    if (f != null) {
        this.rih.setGcodeFile(f.getAbsolutePath());
    }
    // Install listeners...
    backend.addControllerListener(this.rih);
    backend.addUGSEventListener(this.rih);
    // shutdown hook...
    // frame.addWindowListener(this.rih);
    // key listener...
    p.addKeyListener(this.rih);
    // mouse wheel...
    p.addMouseWheelListener(this.rih);
    // mouse motion...
    p.addMouseMotionListener(this.rih);
    // mouse...
    p.addMouseListener(this.rih);
    p.addGLEventListener(renderer);
    return p;
}
Also used : FPSAnimator(com.jogamp.opengl.util.FPSAnimator) GLCapabilities(com.jogamp.opengl.GLCapabilities) GLJPanel(com.jogamp.opengl.awt.GLJPanel) GcodeRenderer(com.willwinder.ugs.nbm.visualizer.shared.GcodeRenderer) Preferences(java.util.prefs.Preferences) NbPreferences(org.openide.util.NbPreferences) File(java.io.File)

Example 2 with GLJPanel

use of com.jogamp.opengl.awt.GLJPanel in project artisynth_core by artisynth.

the class JOGLTest method main.

public static void main(String[] args) {
    // getting the capabilities object of GL2 profile
    final GLProfile profile = GLProfile.get(GLProfile.GL2);
    GLCapabilities capabilities = new GLCapabilities(profile);
    // The canvas
    final GLJPanel glcanvas = new GLJPanel(capabilities);
    JOGLTest b = new JOGLTest();
    glcanvas.addGLEventListener(b);
    glcanvas.setSize(400, 400);
    // creating frame
    final JFrame frame = new JFrame(" Basic Frame");
    // adding canvas to it
    frame.getContentPane().add(glcanvas);
    frame.setSize(frame.getContentPane().getPreferredSize());
    frame.setVisible(true);
}
Also used : GLCapabilities(com.jogamp.opengl.GLCapabilities) JFrame(javax.swing.JFrame) GLJPanel(com.jogamp.opengl.awt.GLJPanel) GLProfile(com.jogamp.opengl.GLProfile)

Example 3 with GLJPanel

use of com.jogamp.opengl.awt.GLJPanel in project artisynth_core by artisynth.

the class GL3Sample method newJFrame.

public static JFrame newJFrame(String name, GLEventListener sample, int x, int y, int width, int height) {
    JFrame frame = new JFrame(name);
    frame.setBounds(x, y, width, height);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    GLProfile glp = GLProfile.get(GLProfile.GL3);
    GLCapabilities glCapabilities = new GLCapabilities(glp);
    // GLCanvas canvas = new GLCanvas(glCapabilities);
    GLJPanel canvas = new GLJPanel(glCapabilities);
    canvas.addGLEventListener(sample);
    frame.add(canvas);
    return frame;
}
Also used : GLCapabilities(com.jogamp.opengl.GLCapabilities) JFrame(javax.swing.JFrame) GLJPanel(com.jogamp.opengl.awt.GLJPanel) GLProfile(com.jogamp.opengl.GLProfile)

Example 4 with GLJPanel

use of com.jogamp.opengl.awt.GLJPanel in project narchy by automenta.

the class DesktopOverlay method main.

public static void main(String[] args) throws IOException {
    // Indeed, use GLJPanel instead of GLCanvas
    GLProfile glp = GLProfile.getDefault();
    GLCapabilities glcap = new GLCapabilities(glp);
    glcap.setAlphaBits(8);
    GLJPanel pane = new GLJPanel(glcap);
    pane.setOpaque(false);
    NWindow n = new NWindow("x", pane).show(500, 500);
}
Also used : GLCapabilities(com.jogamp.opengl.GLCapabilities) GLJPanel(com.jogamp.opengl.awt.GLJPanel) NWindow(automenta.vivisect.swing.NWindow) GLProfile(com.jogamp.opengl.GLProfile)

Aggregations

GLCapabilities (com.jogamp.opengl.GLCapabilities)4 GLJPanel (com.jogamp.opengl.awt.GLJPanel)4 GLProfile (com.jogamp.opengl.GLProfile)3 JFrame (javax.swing.JFrame)2 NWindow (automenta.vivisect.swing.NWindow)1 FPSAnimator (com.jogamp.opengl.util.FPSAnimator)1 GcodeRenderer (com.willwinder.ugs.nbm.visualizer.shared.GcodeRenderer)1 File (java.io.File)1 Preferences (java.util.prefs.Preferences)1 NbPreferences (org.openide.util.NbPreferences)1