Search in sources :

Example 6 with GLCapabilities

use of com.jogamp.opengl.GLCapabilities in project artisynth_core by artisynth.

the class GL3JPanelTest method main.

public static void main(String[] args) {
    GLProfile glp = GLProfile.getDefault();
    GLCapabilities caps = new GLCapabilities(glp);
    caps.setSampleBuffers(true);
    caps.setNumSamples(8);
    caps.setPBuffer(false);
    // GLCanvas canvas = new GLCanvas(caps);
    progManager = new GL3ProgramManager();
    if (resources == null) {
        // get attribute map from GLSL generator
        StringIntPair[] attributes = GLSLGenerator.ATTRIBUTES;
        GL3VertexAttributeMap attributeMap = new GL3VertexAttributeMap(new GL3VertexAttributeInfo(attributes[0].getString(), attributes[0].getInt()), new GL3VertexAttributeInfo(attributes[1].getString(), attributes[1].getInt()), new GL3VertexAttributeInfo(attributes[2].getString(), attributes[2].getInt()), new GL3VertexAttributeInfo(attributes[3].getString(), attributes[3].getInt()));
        for (int i = 4; i < attributes.length; ++i) {
            attributeMap.add(new GL3VertexAttributeInfo(attributes[i].getString(), attributes[i].getInt()));
        }
        resources = new GL3SharedResources(caps, attributeMap);
    }
    lightManager = new GLLightManager();
    setDefaultLights();
    final GLJPanel canvas = resources.createPanel();
    final Frame frame = new Frame("AWT Window Test");
    frame.setSize(width, height);
    frame.setLocation(30, 30);
    frame.add(canvas);
    frame.setVisible(true);
    resources.registerViewer(frame);
    frame.addWindowListener(new WindowAdapter() {

        public void windowClosing(WindowEvent e) {
            frame.remove(canvas);
            resources.deregisterViewer(frame);
            frame.dispose();
            System.exit(0);
        }
    });
    canvas.addGLEventListener(new GL3JPanelTest());
    FPSAnimator animator = new FPSAnimator(canvas, 60);
    animator.start();
}
Also used : GL3ProgramManager(maspack.render.GL.GL3.GL3ProgramManager) Frame(java.awt.Frame) GL3SharedResources(maspack.render.GL.GL3.GL3SharedResources) WindowAdapter(java.awt.event.WindowAdapter) GLLightManager(maspack.render.GL.GLLightManager) StringIntPair(maspack.render.GL.GL3.GLSLGenerator.StringIntPair) GL3VertexAttributeInfo(maspack.render.GL.GL3.GL3VertexAttributeInfo) FPSAnimator(com.jogamp.opengl.util.FPSAnimator) GLCapabilities(com.jogamp.opengl.GLCapabilities) GLJPanel(maspack.render.GL.jogl.GLJPanel) WindowEvent(java.awt.event.WindowEvent) GL3VertexAttributeMap(maspack.render.GL.GL3.GL3VertexAttributeMap) GLProfile(com.jogamp.opengl.GLProfile)

Example 7 with GLCapabilities

use of com.jogamp.opengl.GLCapabilities in project artisynth_core by artisynth.

the class GLJPanelTest method main.

public static void main(String[] args) {
    GLProfile glp = GLProfile.getDefault();
    GLCapabilities caps = new GLCapabilities(glp);
    GLJPanel canvas = new GLJPanel(caps);
    final Frame frame = new Frame("AWT Window Test");
    frame.setSize(300, 300);
    frame.setLocation(30, 30);
    frame.add(canvas);
    frame.setVisible(true);
    frame.addWindowListener(new WindowAdapter() {

        public void windowClosing(WindowEvent e) {
            frame.dispose();
            System.exit(0);
        }
    });
    canvas.addGLEventListener(new GLJPanelTest());
    FPSAnimator animator = new FPSAnimator(canvas, 60);
    animator.start();
}
Also used : FPSAnimator(com.jogamp.opengl.util.FPSAnimator) GLCapabilities(com.jogamp.opengl.GLCapabilities) Frame(java.awt.Frame) GLJPanel(maspack.render.GL.jogl.GLJPanel) WindowEvent(java.awt.event.WindowEvent) WindowAdapter(java.awt.event.WindowAdapter) GLProfile(com.jogamp.opengl.GLProfile)

Example 8 with GLCapabilities

use of com.jogamp.opengl.GLCapabilities 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 9 with GLCapabilities

use of com.jogamp.opengl.GLCapabilities in project tdme by andreasdr.

the class PhysicsTest2 method main.

/**
 * Main
 * @param args
 */
public static void main(String[] args) {
    Logger.getLogger("").setLevel(Level.WARNING);
    // create GL canvas
    GLProfile glp = Engine.getProfile();
    GLCapabilities caps = new GLCapabilities(glp);
    // create GL window
    GLWindow glWindow = GLWindow.create(caps);
    glWindow.setTitle("PhysicsTest2");
    // animator
    FPSAnimator animator = new FPSAnimator(glWindow, 60);
    // tdme level editor
    PhysicsTest2 physicsTest2 = new PhysicsTest2();
    // GL Window
    glWindow.addGLEventListener(physicsTest2);
    glWindow.setSize(800, 600);
    glWindow.setVisible(true);
    glWindow.addKeyListener(physicsTest2);
    glWindow.addMouseListener(physicsTest2);
    glWindow.addWindowListener(physicsTest2);
    // start animator
    animator.setUpdateFPSFrames(3, null);
    animator.start();
}
Also used : FPSAnimator(com.jogamp.opengl.util.FPSAnimator) GLCapabilities(com.jogamp.opengl.GLCapabilities) GLWindow(com.jogamp.newt.opengl.GLWindow) GLProfile(com.jogamp.opengl.GLProfile)

Example 10 with GLCapabilities

use of com.jogamp.opengl.GLCapabilities in project tdme by andreasdr.

the class TDMELevelEditor method main.

/**
 * @param args
 */
public static void main(String[] args) {
    String modelFileName = null;
    // 
    Console.println("TDMELevelEditor " + VERSION);
    Console.println("Programmed 2014,...,2017 by Andreas Drewke, drewke.net.");
    Console.println();
    // no nifty logging
    Logger.getLogger("").setLevel(Level.SEVERE);
    // create GL caps
    GLProfile glp = Engine.getProfile();
    GLCapabilities caps = new GLCapabilities(glp);
    Console.println(glp);
    Console.println(caps);
    // create GL window
    GLWindow glWindow = GLWindow.create(caps);
    glWindow.setTitle("TDMELevelEditor " + VERSION);
    // animator
    FPSAnimator animator = new FPSAnimator(glWindow, 60);
    // tdme level editor
    TDMELevelEditor tdmeLevelEditor = new TDMELevelEditor(glWindow, animator, modelFileName);
    // GL Window
    glWindow.addWindowListener(tdmeLevelEditor);
    glWindow.addGLEventListener(tdmeLevelEditor);
    glWindow.setSize(1024, 600);
    glWindow.setVisible(true);
    // start animator
    animator.start();
}
Also used : FPSAnimator(com.jogamp.opengl.util.FPSAnimator) GLCapabilities(com.jogamp.opengl.GLCapabilities) GLWindow(com.jogamp.newt.opengl.GLWindow) GLProfile(com.jogamp.opengl.GLProfile)

Aggregations

GLCapabilities (com.jogamp.opengl.GLCapabilities)27 GLProfile (com.jogamp.opengl.GLProfile)18 FPSAnimator (com.jogamp.opengl.util.FPSAnimator)12 GLWindow (com.jogamp.newt.opengl.GLWindow)8 GLJPanel (com.jogamp.opengl.awt.GLJPanel)4 GLAutoDrawable (com.jogamp.opengl.GLAutoDrawable)3 GLCanvas (com.jogamp.opengl.awt.GLCanvas)3 Frame (java.awt.Frame)3 WindowAdapter (java.awt.event.WindowAdapter)3 WindowEvent (java.awt.event.WindowEvent)3 GLRunnable (com.jogamp.opengl.GLRunnable)2 JFrame (javax.swing.JFrame)2 GL3SharedResources (maspack.render.GL.GL3.GL3SharedResources)2 GL3VertexAttributeInfo (maspack.render.GL.GL3.GL3VertexAttributeInfo)2 GL3VertexAttributeMap (maspack.render.GL.GL3.GL3VertexAttributeMap)2 StringIntPair (maspack.render.GL.GL3.GLSLGenerator.StringIntPair)2 GLJPanel (maspack.render.GL.jogl.GLJPanel)2 NWindow (automenta.vivisect.swing.NWindow)1 MutableGraphicsConfiguration (com.jogamp.nativewindow.MutableGraphicsConfiguration)1 NativeSurface (com.jogamp.nativewindow.NativeSurface)1