当前位置: 首页>>代码示例>>Java>>正文


Java GLWindow.addGLEventListener方法代码示例

本文整理汇总了Java中com.jogamp.newt.opengl.GLWindow.addGLEventListener方法的典型用法代码示例。如果您正苦于以下问题:Java GLWindow.addGLEventListener方法的具体用法?Java GLWindow.addGLEventListener怎么用?Java GLWindow.addGLEventListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jogamp.newt.opengl.GLWindow的用法示例。


在下文中一共展示了GLWindow.addGLEventListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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();
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:38,代码来源:UINewtDemo01.java

示例2: test00RegionRendererNONE01

import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
public void test00RegionRendererNONE01() throws InterruptedException {
    final GLProfile glp = GLProfile.get(GLProfile.GL2ES2);
    final GLCapabilities caps = new GLCapabilities(glp);
//    caps.setOnscreen(false);
    caps.setAlphaBits(4);

    final GLWindow window = createWindow("shape-vbaa0-msaa0", caps, 800, 400);
    final RenderState rs = RenderState.createRenderState(SVertex.factory());

    final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, 0, 0, false, false);
    demo01Listener.attachInputListenerTo(window);
    window.addGLEventListener(demo01Listener);

    final RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion01");
    window.addGLEventListener(listener);

    listener.setTech(-20, 0, -300, 0f, 2);
    window.display();

    listener.setTech(-20, 0, -150, 0f, 3);
    window.display();

    listener.setTech(-20, 0,  -50, 0f, 4);
    window.display();

    destroyWindow(window);
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:28,代码来源:TestRegionRendererNEWT01.java

示例3: test01RegionRendererNONE02

import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
public void test01RegionRendererNONE02() throws InterruptedException {
    if(Platform.CPUFamily.X86 != PlatformPropsImpl.CPU_ARCH.family) { // FIXME
        // FIXME: Disabled for now - since it doesn't seem fit for mobile (performance wise).
        // FIXME: Also the GLSL code for VARIABLE_CURVE is not fit for mobile yet!
        System.err.println("disabled on non desktop (x86) arch for now ..");
        return;
    }
    final GLProfile glp = GLProfile.get(GLProfile.GL2ES2);
    final GLCapabilities caps = new GLCapabilities(glp);
    caps.setAlphaBits(4);

    final GLWindow window = createWindow("shape-vbaa0-msaa0", caps, 800, 400);
    final RenderState rs = RenderState.createRenderState(SVertex.factory());

    final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, Region.VARWEIGHT_RENDERING_BIT, 0, false, false);
    demo01Listener.attachInputListenerTo(window);
    window.addGLEventListener(demo01Listener);

    final RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion02");
    window.addGLEventListener(listener);

    listener.setTech(-20, 0, -300, 0f, 2);
    window.display();

    listener.setTech(-20, 0, -150, 0f, 3);
    window.display();

    listener.setTech(-20, 0,  -50, 0f, 4);
    window.display();

    destroyWindow(window);
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:33,代码来源:TestRegionRendererNEWT01.java

示例4: test10RegionRendererMSAA01

import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
@Test
public void test10RegionRendererMSAA01() throws InterruptedException {
    final GLProfile glp = GLProfile.get(GLProfile.GL2ES2);
    final GLCapabilities caps = new GLCapabilities(glp);
//    caps.setOnscreen(false);
    caps.setAlphaBits(4);
    caps.setSampleBuffers(true);
    caps.setNumSamples(4);

    final GLWindow window = createWindow("shape-vbaa0-msaa1", caps, 800, 400);
    final RenderState rs = RenderState.createRenderState(SVertex.factory());

    final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, 0, 0, false, false);
    demo01Listener.attachInputListenerTo(window);
    window.addGLEventListener(demo01Listener);

    final RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion01");
    window.addGLEventListener(listener);

    listener.setTech(-20, 00, -300, 0f, 2);
    window.display();

    listener.setTech(-20, 00, -150, 0f, 3);
    window.display();

    listener.setTech(-20, 00,  -50, 0f, 4);
    window.display();

    destroyWindow(window);
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:31,代码来源:TestRegionRendererNEWT01.java

示例5: test11RegionRendererMSAA02

import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
public void test11RegionRendererMSAA02() throws InterruptedException {
    if(Platform.CPUFamily.X86 != PlatformPropsImpl.CPU_ARCH.family) { // FIXME
        // FIXME: Disabled for now - since it doesn't seem fit for mobile (performance wise).
        // FIXME: Also the GLSL code for VARIABLE_CURVE is not fit for mobile yet!
        System.err.println("disabled on non desktop (x86) arch for now ..");
        return;
    }
    final GLProfile glp = GLProfile.get(GLProfile.GL2ES2);
    final GLCapabilities caps = new GLCapabilities(glp);
    caps.setAlphaBits(4);
    caps.setSampleBuffers(true);
    caps.setNumSamples(4);

    final GLWindow window = createWindow("shape-vbaa0-msaa1", caps, 800, 400);
    final RenderState rs = RenderState.createRenderState(SVertex.factory());

    final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, Region.VARWEIGHT_RENDERING_BIT, 0, false, false);
    demo01Listener.attachInputListenerTo(window);
    window.addGLEventListener(demo01Listener);

    final RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion02");
    window.addGLEventListener(listener);

    listener.setTech(-20, 00, -300, 0f, 2);
    window.display();

    listener.setTech(-20, 00, -150, 0f, 3);
    window.display();

    listener.setTech(-20, 00,  -50, 0f, 4);
    window.display();

    destroyWindow(window);
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:35,代码来源:TestRegionRendererNEWT01.java

示例6: test20RegionRendererR2T01

import com.jogamp.newt.opengl.GLWindow; //导入方法依赖的package包/类
@Test
public void test20RegionRendererR2T01() throws InterruptedException {
    if(Platform.CPUFamily.X86 != PlatformPropsImpl.CPU_ARCH.family) { // FIXME
        // FIXME: Disabled for now - since it doesn't seem fit for mobile (performance wise).
        System.err.println("disabled on non desktop (x86) arch for now ..");
        return;
    }
    final GLProfile glp = GLProfile.getGL2ES2();

    final GLCapabilities caps = new GLCapabilities(glp);
    //caps.setOnscreen(false);
    caps.setAlphaBits(4);

    final GLWindow window = createWindow("shape-vbaa1-msaa0", caps, 800,400);
    final RenderState rs = RenderState.createRenderState(SVertex.factory());
    final GPURegionGLListener02  demo02Listener = new GPURegionGLListener02 (rs, Region.VBAA_RENDERING_BIT, 4, false, false);
    demo02Listener.attachInputListenerTo(window);
    window.addGLEventListener(demo02Listener);

    final RegionGLListener listener = new RegionGLListener(demo02Listener, window.getTitle(), "GPURegionNewtDemo02");
    window.addGLEventListener(listener);

    listener.setTech(-20, 00, -300, 0f, 2);
    window.display();

    listener.setTech(-20, 00, -150, 0f, 3);
    window.display();

    listener.setTech(-20, 00,  -50, 0f, 4);
    window.display();

    destroyWindow(window);
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:34,代码来源:TestRegionRendererNEWT01.java

示例7: 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();
}
 
开发者ID:andreasdr,项目名称:tdme,代码行数:33,代码来源:EngineTest.java

示例8: 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();
}
 
开发者ID:andreasdr,项目名称:tdme,代码行数:33,代码来源:PhysicsTest1.java

示例9: 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();
}
 
开发者ID:andreasdr,项目名称:tdme,代码行数:34,代码来源:PhysicsTest2.java

示例10: 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();
}
 
开发者ID:andreasdr,项目名称:tdme,代码行数:36,代码来源:GUITest.java

示例11: 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();
}
 
开发者ID:andreasdr,项目名称:tdme,代码行数:34,代码来源:PhysicsTest3.java

示例12: 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();
}
 
开发者ID:andreasdr,项目名称:tdme,代码行数:38,代码来源:TDMEParticleSystem.java

示例13: 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();
}
 
开发者ID:andreasdr,项目名称:tdme,代码行数:40,代码来源:TDMELevelEditor.java

示例14: 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();
}
 
开发者ID:andreasdr,项目名称:tdme,代码行数:40,代码来源:TDMEViewer.java

示例15: 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);

}
 
开发者ID:NLeSC,项目名称:Neon,代码行数:57,代码来源:NeonNewtWindow.java


注:本文中的com.jogamp.newt.opengl.GLWindow.addGLEventListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。