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();
}
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();
}
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;
}
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();
}
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();
}
Aggregations