本文整理汇总了Java中com.jogamp.newt.opengl.GLWindow.addWindowListener方法的典型用法代码示例。如果您正苦于以下问题:Java GLWindow.addWindowListener方法的具体用法?Java GLWindow.addWindowListener怎么用?Java GLWindow.addWindowListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.newt.opengl.GLWindow
的用法示例。
在下文中一共展示了GLWindow.addWindowListener方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
public static void main(String[] args) {
GLProfile glp = GLProfile.get("GL3");
GLCapabilities caps = new GLCapabilities(glp);
GLWindow glWindow = GLWindow.create(caps);
glWindow.setSize(800, 600);
glWindow.setVisible(true);
glWindow.addWindowListener(new WindowAdapter() {
public void windowDestroyNotify(WindowEvent e) {
System.exit(0);
}
});
FPSAnimator animator = new FPSAnimator(glWindow, 60);
animator.start();
}
示例2: main
import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
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();
}
示例3: main
import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
/**
* @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("EngineTest");
// animator
FPSAnimator animator = new FPSAnimator(glWindow, 60);
// tdme level editor
EngineTest engineTest = new EngineTest(glWindow, animator);
// GL Window
glWindow.addGLEventListener(engineTest);
glWindow.setSize(800, 600);
glWindow.setVisible(true);
glWindow.addKeyListener(engineTest);
glWindow.addMouseListener(engineTest);
glWindow.addWindowListener(engineTest);
// start animator
animator.setUpdateFPSFrames(3, null);
animator.start();
}
示例4: main
import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
/**
* @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("PhysicsTest1");
// animator
FPSAnimator animator = new FPSAnimator(glWindow, 60);
// tdme level editor
PhysicsTest1 physicsTest1 = new PhysicsTest1();
// GL Window
glWindow.addGLEventListener(physicsTest1);
glWindow.setSize(800, 600);
glWindow.setVisible(true);
glWindow.addKeyListener(physicsTest1);
glWindow.addMouseListener(physicsTest1);
glWindow.addWindowListener(physicsTest1);
// start animator
animator.setUpdateFPSFrames(3, null);
animator.start();
}
示例5: main
import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
/**
* 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();
}
示例6: main
import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
/**
* @param args
*/
public static void main(String[] args) {
Logger.getLogger("").setLevel(Level.WARNING);
// gl profile
GLProfile glp = Engine.getProfile();
// create GL caps
GLCapabilities caps = new GLCapabilities(glp);
caps.setBackgroundOpaque(true);
caps.setDepthBits(16);
caps.setDoubleBuffered(true);
Console.println(glp);
Console.println(caps);
// create GL window
GLWindow glWindow = GLWindow.create(caps);
glWindow.setTitle("GUI Test");
glWindow.setSize(800, 600);
// animator
FPSAnimator animator = new FPSAnimator(glWindow, 60);
animator.setUpdateFPSFrames(3, null);
// create test
GUITest guiTest = new GUITest(glWindow);
glWindow.addGLEventListener(guiTest);
glWindow.addWindowListener(guiTest);
glWindow.setVisible(true);
// start animator
animator.start();
}
示例7: main
import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
/**
* 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("PhysicsTest3");
// animator
FPSAnimator animator = new FPSAnimator(glWindow, 60);
// tdme level editor
PhysicsTest3 physicsTest3 = new PhysicsTest3();
// GL Window
glWindow.addGLEventListener(physicsTest3);
glWindow.setSize(800, 600);
glWindow.setVisible(true);
glWindow.addKeyListener(physicsTest3);
glWindow.addMouseListener(physicsTest3);
glWindow.addWindowListener(physicsTest3);
// start animator
animator.setUpdateFPSFrames(3, null);
animator.start();
}
示例8: main
import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
/**
* @param args
*/
public static void main(String[] args) {
//
Console.println("TDMEParticleSystem " + VERSION);
Console.println("Programmed 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("TDMEParticleSystem " + VERSION);
// animator
FPSAnimator animator = new FPSAnimator(glWindow, 60);
// tdme particle system
TDMEParticleSystem tdmeLevelEditor = new TDMEParticleSystem(glWindow, animator);
// GL Window
glWindow.addWindowListener(tdmeLevelEditor);
glWindow.addGLEventListener(tdmeLevelEditor);
glWindow.setSize(800, 600);
glWindow.setVisible(true);
// start animator
animator.start();
}
示例9: main
import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
/**
* @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();
}
示例10: main
import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
/**
* @param args
*/
public static void main(String[] args) {
String modelFileName = null;
//
Console.println("TDMEViewer " + 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("TDMEViewer " + VERSION);
// animator
FPSAnimator animator = new FPSAnimator(glWindow, 60);
// tdme level editor
TDMEViewer tdmeLevelEditor = new TDMEViewer(glWindow, animator, modelFileName);
// GL Window
glWindow.addWindowListener(tdmeLevelEditor);
glWindow.addGLEventListener(tdmeLevelEditor);
glWindow.setSize(800, 600);
glWindow.setVisible(true);
// start animator
animator.start();
}
示例11: NeonNewtWindow
import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
/**
* Constructor for this class. Sets up the window and enables common
* features like anti-aliasing and hardware acceleration.
*
* @param forceGL2ES2
* Force GL2ES2 support (default on), currently Unused
* @param inputHandler
* A predefined InputHandler that is added as event handler for
* input events.
* @param glEventListener
* A predefined GLEventListener that is added as event handler
* for openGL events.
* @param width
* The initial window width.
* @param height
* The initial window height.
* @param windowTitle
* The window title.
*/
public NeonNewtWindow(boolean forceGL2ES2, InputHandler inputHandler, final GLEventListener glEventListener,
int width, int height, String windowTitle) {
GLProfile.initSingleton();
final GLProfile glp;
glp = GLProfile.get(GLProfile.GL3);
// Set up the GL context
final GLCapabilities caps = new GLCapabilities(glp);
caps.setBackgroundOpaque(true);
caps.setHardwareAccelerated(true);
caps.setDoubleBuffered(true);
// Add Anti-Aliasing
caps.setSampleBuffers(true);
caps.setAlphaBits(4);
caps.setNumSamples(4);
GLWindow window = GLWindow.create(caps);
window.addGLEventListener(glEventListener);
window.addWindowListener(new QuitListener());
window.setAutoSwapBufferMode(true);
window.setSize(width, height);
window.setTitle(windowTitle);
window.addMouseListener(inputHandler);
window.addKeyListener(inputHandler);
Animator animator = new Animator();
animator.add(window);
animator.start();
animator.setUpdateFPSFrames(60, null);
window.setVisible(true);
}
示例12: main
import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
public static void main(final String[] args) {
int width = 800, height = 400;
int x = 10, y = 10;
boolean forceES2 = false;
boolean forceES3 = false;
boolean forceGL3 = false;
boolean forceGLDef = false;
System.err.println("forceES2 "+forceES2);
System.err.println("forceES3 "+forceES3);
System.err.println("forceGL3 "+forceGL3);
System.err.println("forceGLDef "+forceGLDef);
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 Mode "+GraphMSAAMode);
System.err.println("Graph VBAA Mode "+GraphVBAAMode);
System.err.println("Graph Auto Mode "+GraphAutoMode+" no-AA dpi threshold");
final GLProfile glp;
if(forceGLDef) {
glp = GLProfile.getDefault();
} else if(forceGL3) {
glp = GLProfile.get(GLProfile.GL3);
} else if(forceES3) {
glp = GLProfile.get(GLProfile.GLES3);
} else if(forceES2) {
glp = GLProfile.get(GLProfile.GLES2);
} else {
glp = GLProfile.getGL2ES2();
}
System.err.println("GLProfile: "+glp);
final GLCapabilities caps = new GLCapabilities(glp);
caps.setAlphaBits(4);
if( SceneMSAASamples > 0 ) {
caps.setSampleBuffers(true);
caps.setNumSamples(SceneMSAASamples);
}
System.out.println("Requested: " + caps);
final int rmode;
if( GraphVBAAMode ) {
rmode = Region.VBAA_RENDERING_BIT;
} else if( GraphMSAAMode ) {
rmode = Region.MSAA_RENDERING_BIT;
} else {
rmode = 0;
}
final GLWindow window = GLWindow.create(caps);
window.setPosition(x, y);
window.setSize(width, height);
window.setTitle("GraphUI Newt Demo: graph["+Region.getRenderModeString(rmode)+"], msaa "+SceneMSAASamples);
window.setSurfaceScale(reqSurfacePixelScale);
final float[] valReqSurfacePixelScale = window.getRequestedSurfaceScale(new float[2]);
final GPUUISceneGLListener0A sceneGLListener = 0 < GraphAutoMode ? new GPUUISceneGLListener0A(GraphAutoMode, DEBUG, TRACE) :
new GPUUISceneGLListener0A(rmode, DEBUG, TRACE);
window.addGLEventListener(sceneGLListener);
sceneGLListener.attachInputListenerTo(window);
final Animator animator = new Animator();
animator.setUpdateFPSFrames(60, System.err);
animator.add(window);
window.addWindowListener(new WindowAdapter() {
public void windowDestroyed(final WindowEvent e) {
animator.stop();
}
});
window.setVisible(true);
animator.start();
}