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


Java GLWindow类代码示例

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


GLWindow类属于com.jogamp.newt.opengl包,在下文中一共展示了GLWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
 
开发者ID:bensmith87,项目名称:jogl_gradle,代码行数:19,代码来源:Main.java

示例2: VisualizationPanel

import com.jogamp.newt.opengl.GLWindow; //导入依赖的package包/类
/**
 * Constructs a new visualization-panel using the specified configuration.
 *
 * @param visualization the visualization to be displayed.
 * @param config        the configuration for the visualization-panel to be created.
 */
public VisualizationPanel(Visualization visualization, VisualizerConfig config) {
    this.visualization = visualization;

    window = GLWindow.create(config.glcapabilities);
    window.addGLEventListener(visualization.getRenderContext());
    window.addMouseListener(visualization.getMouseListener());
    window.addKeyListener(visualization.getKeyController());

    animator = new FPSAnimator(window, config.fps, true);
    visualization.getRenderContext().setAnimator(animator);

    canvas = new NewtCanvasAWT(window);

    this.setLayout(new BorderLayout());
    this.add(canvas, BorderLayout.CENTER);
}
 
开发者ID:sgs-us,项目名称:microtrafficsim,代码行数:23,代码来源:VisualizationPanel.java

示例3: setup

import com.jogamp.newt.opengl.GLWindow; //导入依赖的package包/类
private void setup() {

        GLProfile glProfile = GLProfile.get(GLProfile.GL3);
        GLCapabilities glCapabilities = new GLCapabilities(glProfile);

        window = GLWindow.create(glCapabilities);

        window.setTitle("Hello Triangle (enhanced)");
        window.setSize(1024, 768);

        window.setVisible(true);

        window.addGLEventListener(this);
        window.addKeyListener(this);

        animator = new Animator(window);
        animator.start();

        window.addWindowListener(new WindowAdapter() {
            @Override
            public void windowDestroyed(WindowEvent e) {
                animator.stop();
                System.exit(1);
            }
        });
    }
 
开发者ID:java-opengl-labs,项目名称:hello-triangle,代码行数:27,代码来源:HelloTriangle.java

示例4: setup

import com.jogamp.newt.opengl.GLWindow; //导入依赖的package包/类
private void setup() {

        GLProfile glProfile = GLProfile.get(GLProfile.GL3);
        GLCapabilities glCapabilities = new GLCapabilities(glProfile);

        window = GLWindow.create(glCapabilities);

        window.setTitle("Input into rendering");
        window.setSize(1024, 768);

        window.addGLEventListener(this);
        window.addKeyListener(this);

        window.setVisible(true);

        animator = new Animator(window);
        animator.start();

        window.addWindowListener(new WindowAdapter() {
            @Override
            public void windowDestroyed(WindowEvent e) {
                animator.stop();
                System.exit(1);
            }
        });
    }
 
开发者ID:java-opengl-labs,项目名称:hello-triangle,代码行数:27,代码来源:Input_into_rendering.java

示例5: actionPerformed

import com.jogamp.newt.opengl.GLWindow; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
    GLWindow window = ImageViewerGui.getGLWindow();
    boolean full = window.isFullscreen();
    if (full) {
        KeyShortcuts.unregisterKey(exitKey);
        KeyShortcuts.unregisterKey(playKey);
    } else {
        KeyShortcuts.registerKey(exitKey, this);
        KeyShortcuts.registerKey(playKey, MoviePanel.getPlayPauseAction());
    }

    int w = ImageViewerGui.getGLComponent().getWidth();
    int h = ImageViewerGui.getGLComponent().getHeight();

    new Thread(() -> {
        window.setFullscreen(!full);
        if (full) // it may have ignored size requests in full screen
            window.setSize(w, h);
    }).start();
}
 
开发者ID:Helioviewer-Project,项目名称:JHelioviewer-SWHV,代码行数:22,代码来源:ToggleFullscreenAction.java

示例6: init

import com.jogamp.newt.opengl.GLWindow; //导入依赖的package包/类
public void init(final GLAutoDrawable drawable) {
    if(drawable instanceof GLWindow) {
        final GLWindow glw = (GLWindow) drawable;
        attachInputListenerTo(glw);
    }
    super.init(drawable);

    final GL2ES2 gl = drawable.getGL().getGL2ES2();

    final RenderState rs = getRenderer().getRenderState();

    gl.setSwapInterval(1);
    gl.glEnable(GL.GL_DEPTH_TEST);
    gl.glEnable(GL.GL_BLEND);
    rs.setColorStatic(0.1f, 0.1f, 0.1f, 1.0f);
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:17,代码来源:GPUTextGLListener0A.java

示例7: dispose

import com.jogamp.newt.opengl.GLWindow; //导入依赖的package包/类
@Override
public void dispose(final GLAutoDrawable drawable) {
    if(drawable instanceof GLWindow) {
        System.err.println("GPUUISceneGLListener0A: dispose (1)");
        final GLWindow glw = (GLWindow) drawable;
        detachInputListenerFrom(glw);
    } else {
        System.err.println("GPUUISceneGLListener0A: dispose (0)");
    }

    sceneUIController.dispose(drawable); // disposes all registered UIShapes

    final GL2ES2 gl = drawable.getGL().getGL2ES2();
    renderer.destroy(gl);
    screenshot.dispose(gl);
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:17,代码来源:GPUUISceneGLListener0A.java

示例8: createWindow

import com.jogamp.newt.opengl.GLWindow; //导入依赖的package包/类
@Override
public Object createWindow(GLCapabilities caps, int width, int height) {
	final Animator animator;
	setAutoDrawable(glWin = GLWindow.create(caps));
	setAnimator(animator = new Animator(glWin));
	glWin.addWindowListener(new WindowAdapter() {
		@Override
		public void windowDestroyNotify(WindowEvent e) {
			animator.stop();
			glWin.setVisible(false);
			// prevent jogl babbling about unimportant stuff
			System.err.close();
			System.exit(0);
		}
	});

	glWin.setDefaultCloseOperation(WindowClosingMode.DISPOSE_ON_CLOSE);
	glWin.setSize(width, height);
	glWin.setTitle("bGLOOP");
	return glWin;
}
 
开发者ID:trent2,项目名称:bGLOOP,代码行数:22,代码来源:NEWTWindow.java

示例9: readMouse

import com.jogamp.newt.opengl.GLWindow; //导入依赖的package包/类
/**
 * Determines how far the mouse moved from the center and resets the mouse to the center.
 * The information can be retrieved with {@code getMouseX()} and {@code getMouseY()}.
 * @see #getMouseX
 * @see #getMouseY
 */
public void readMouse() {
	GLWindow win = c.getWindow();
	
	if (win.hasFocus() && focused) {
		Point mousePos = MouseInfo.getPointerInfo().getLocation();
		int centerX = win.getX() + win.getWidth()/2;
		int centerY = win.getY() + win.getHeight()/2;
		
		mouseX = (mousePos.getX()-centerX)*mouseSensitivity;
		mouseY = (mousePos.getY()-centerY)*mouseSensitivity;
		
		robot.mouseMove(centerX, centerY);
	} else {
		setFocused(false);
		mouseX = 0;
		mouseY = 0;
	}
}
 
开发者ID:patowen,项目名称:hyperbolic-space,代码行数:25,代码来源:InputHandler.java

示例10: main

import com.jogamp.newt.opengl.GLWindow; //导入依赖的package包/类
public static void main(String[] args) {

        Display display = NewtFactory.createDisplay(null);
        Screen screen = NewtFactory.createScreen(display, 0);
        GLProfile glProfile = GLProfile.get(GLProfile.GL3);
        GLCapabilities glCapabilities = new GLCapabilities(glProfile);
        glWindow = GLWindow.create(screen, glCapabilities);

        glWindow.setSize(1044, 768);
        glWindow.setPosition(100, 50);
        glWindow.setUndecorated(false);
        glWindow.setAlwaysOnTop(false);
        glWindow.setFullscreen(false);
        glWindow.setPointerVisible(true);
        glWindow.confinePointer(false);
        glWindow.setTitle("Tutorial 09 - Interpolation");
        glWindow.setContextCreationFlags(GLContext.CTX_OPTION_DEBUG);
        glWindow.setVisible(true);

        Tutorial09 tutorial09 = new Tutorial09();
        glWindow.addGLEventListener(tutorial09);

        animator = new Animator(glWindow);
        animator.start();
    }
 
开发者ID:java-opengl-labs,项目名称:ogl-dev,代码行数:26,代码来源:Tutorial09.java

示例11: main

import com.jogamp.newt.opengl.GLWindow; //导入依赖的package包/类
public static void main(String[] args) {

        Display display = NewtFactory.createDisplay(null);
        Screen screen = NewtFactory.createScreen(display, 0);
        GLProfile glProfile = GLProfile.get(GLProfile.GL3);
        GLCapabilities glCapabilities = new GLCapabilities(glProfile);
        glWindow = GLWindow.create(screen, glCapabilities);

        glWindow.setSize(1044, 768);
        glWindow.setPosition(100, 50);
        glWindow.setUndecorated(false);
        glWindow.setAlwaysOnTop(false);
        glWindow.setFullscreen(false);
        glWindow.setPointerVisible(true);
        glWindow.confinePointer(false);
        glWindow.setTitle("Tutorial 05 - Uniform Variables");
        glWindow.setContextCreationFlags(GLContext.CTX_OPTION_DEBUG);
        glWindow.setVisible(true);

        Tutorial05 tutorial05 = new Tutorial05();
        glWindow.addGLEventListener(tutorial05);

        animator = new Animator(glWindow);
        animator.start();
    }
 
开发者ID:java-opengl-labs,项目名称:ogl-dev,代码行数:26,代码来源:Tutorial05.java

示例12: main

import com.jogamp.newt.opengl.GLWindow; //导入依赖的package包/类
public static void main(String[] args) {

        Display display = NewtFactory.createDisplay(null);
        Screen screen = NewtFactory.createScreen(display, 0);
        GLProfile glProfile = GLProfile.get(GLProfile.GL3);
        GLCapabilities glCapabilities = new GLCapabilities(glProfile);
        glWindow = GLWindow.create(screen, glCapabilities);

        glWindow.setSize(1034, 768);
        glWindow.setPosition(100, 50);
        glWindow.setUndecorated(false);
        glWindow.setAlwaysOnTop(false);
        glWindow.setFullscreen(false);
        glWindow.setPointerVisible(true);
        glWindow.confinePointer(false);
        glWindow.setTitle("Tutorial 03 - First triangle");
        glWindow.setContextCreationFlags(GLContext.CTX_OPTION_DEBUG);
        glWindow.setVisible(true);

        Tutorial03 tutorial03 = new Tutorial03();
        glWindow.addGLEventListener(tutorial03);

        animator = new Animator(glWindow);
        animator.start();
    }
 
开发者ID:java-opengl-labs,项目名称:ogl-dev,代码行数:26,代码来源:Tutorial03.java

示例13: main

import com.jogamp.newt.opengl.GLWindow; //导入依赖的package包/类
public static void main(String[] args) {

        Display display = NewtFactory.createDisplay(null);
        Screen screen = NewtFactory.createScreen(display, 0);
        GLProfile glProfile = GLProfile.get(GLProfile.GL3);
        GLCapabilities glCapabilities = new GLCapabilities(glProfile);
        glWindow = GLWindow.create(screen, glCapabilities);

        glWindow.setSize(1044, 768);
        glWindow.setPosition(100, 50);
        glWindow.setUndecorated(false);
        glWindow.setAlwaysOnTop(false);
        glWindow.setFullscreen(false);
        glWindow.setPointerVisible(true);
        glWindow.confinePointer(false);
        glWindow.setTitle("Tutorial 08 - Scaling Transformation");
        glWindow.setContextCreationFlags(GLContext.CTX_OPTION_DEBUG);
        glWindow.setVisible(true);

        Tutorial08 tutorial08 = new Tutorial08();
        glWindow.addGLEventListener(tutorial08);

        animator = new Animator(glWindow);
        animator.start();
    }
 
开发者ID:java-opengl-labs,项目名称:ogl-dev,代码行数:26,代码来源:Tutorial08.java

示例14: main

import com.jogamp.newt.opengl.GLWindow; //导入依赖的package包/类
public static void main(String[] args) {

        Display display = NewtFactory.createDisplay(null);
        Screen screen = NewtFactory.createScreen(display, 0);
        GLProfile glProfile = GLProfile.get(GLProfile.GL3);
        GLCapabilities glCapabilities = new GLCapabilities(glProfile);
        glWindow = GLWindow.create(screen, glCapabilities);

        glWindow.setSize(1044, 768);
        glWindow.setPosition(100, 50);
        glWindow.setUndecorated(false);
        glWindow.setAlwaysOnTop(false);
        glWindow.setFullscreen(false);
        glWindow.setPointerVisible(true);
        glWindow.confinePointer(false);
        glWindow.setTitle("Tutorial 04 - Shaders");
        glWindow.setContextCreationFlags(GLContext.CTX_OPTION_DEBUG);
        glWindow.setVisible(true);

        Tutorial04 tutorial04 = new Tutorial04();
        glWindow.addGLEventListener(tutorial04);

        animator = new Animator(glWindow);
        animator.start();
    }
 
开发者ID:java-opengl-labs,项目名称:ogl-dev,代码行数:26,代码来源:Tutorial04.java

示例15: main

import com.jogamp.newt.opengl.GLWindow; //导入依赖的package包/类
public static void main(String[] args) {

        Display display = NewtFactory.createDisplay(null);
        Screen screen = NewtFactory.createScreen(display, 0);
        GLProfile glProfile = GLProfile.get(GLProfile.GL3);
        GLCapabilities glCapabilities = new GLCapabilities(glProfile);
        glWindow = GLWindow.create(screen, glCapabilities);

        glWindow.setSize(1044, 768);
        glWindow.setPosition(100, 50);
        glWindow.setUndecorated(false);
        glWindow.setAlwaysOnTop(false);
        glWindow.setFullscreen(false);
        glWindow.setPointerVisible(true);
        glWindow.confinePointer(false);
        glWindow.setTitle("Tutorial 06 - Translation Transformation");
        glWindow.setContextCreationFlags(GLContext.CTX_OPTION_DEBUG);
        glWindow.setVisible(true);

        Tutorial06 tutorial06 = new Tutorial06();
        glWindow.addGLEventListener(tutorial06);

        animator = new Animator(glWindow);
        animator.start();
    }
 
开发者ID:java-opengl-labs,项目名称:ogl-dev,代码行数:26,代码来源:Tutorial06.java


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