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


Java GLCanvas.setSize方法代码示例

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


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

示例1: createUI_90_OpenGL

import javax.media.opengl.awt.GLCanvas; //导入方法依赖的package包/类
private void createUI_90_OpenGL(final Composite parent) {

		_glCanvas = new GLCanvas(_glCaps);
		_glCanvas.addGLEventListener(new GLInfo());
		_glCanvas.setSize(10, 10);

		// set parent griddata, this must be done AFTER the content is created, otherwise it fails !!!
//		GridDataFactory.fillDefaults().grab(true, true).applyTo(parent);

		// build GUI: container(SWT) -> Frame(AWT) -> Panel(AWT) -> WorldWindowGLCanvas(AWT)
		_mapContainer = _tk.createComposite(parent, SWT.EMBEDDED);
		GridDataFactory.fillDefaults().hint(10, 20).applyTo(_mapContainer);
		{
			_awtFrame = SWT_AWT.new_Frame(_mapContainer);
			final java.awt.Panel awtPanel = new java.awt.Panel(new java.awt.BorderLayout());

			_awtFrame.add(awtPanel);
			awtPanel.add(_glCanvas, BorderLayout.CENTER);
		}

		_mapContainer.setVisible(false);

		parent.layout();
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:25,代码来源:ActionOpenGLVersions.java

示例2: Scene

import javax.media.opengl.awt.GLCanvas; //导入方法依赖的package包/类
Scene(Kengine kengine){
    this.kengine = kengine;
    GLProfile glprofile = GLProfile.getDefault();
    GLCapabilities glcapabilities = new GLCapabilities( glprofile );
    canvas = new GLCanvas(glcapabilities);
    canvas.setSize(kengine.getWidth(), kengine.getHeight());
    canvas.addGLEventListener(this);
    canvas.addMouseMotionListener(mkMouseAdapter());
    canvas.addMouseListener(mkMouseAdapter());
    canvas.addKeyListener(mkKeyAdapter());
    canvas.requestFocus();

    fpsa = new FPSAnimator(canvas,60,true);
    fpsa.start();

    kengine.add(canvas);

    hideCursor();
    try {
        rob = new Robot();
    } catch (AWTException e) {
        e.printStackTrace();
    }
    mouseCenter = (int) (kengine.getHeight()*.5);
}
 
开发者ID:seemywingz,项目名称:Kengine,代码行数:26,代码来源:Scene.java

示例3: init

import javax.media.opengl.awt.GLCanvas; //导入方法依赖的package包/类
private void init(final boolean fullScreen,
        final GLCapabilitiesImmutable caps, final GLContext shareWith) {
    Runnable r = new Runnable() { public void run() {
        String wasErase = System.setProperty("sun.awt.noerasebackground", "true");

        canvas = new GLCanvas(caps, shareWith);
        ((GLCanvas)canvas).addGLEventListener(eventListener);
        if (fullScreen) {
            canvas.setSize(getSize());
            needInitialResize = false;
        } else {
            canvas.setSize(1, 1); // or we do not get a GLContext
            needInitialResize = true;
        }
        getContentPane().add(canvas);
        canvas.setVisible(true);

        if (wasErase != null) {
            System.setProperty("sun.awt.noerasebackground", wasErase);
        } else {
            System.clearProperty("sun.awt.noerasebackground");
        }
    }};

    if (EventQueue.isDispatchThread()) {
        r.run();
    } else {
        try {
            EventQueue.invokeAndWait(r);
        } catch (java.lang.Exception ex) { }
    }
}
 
开发者ID:wordin0,项目名称:javacv,代码行数:33,代码来源:GLCanvasFrame.java

示例4: initGLCanvas

import javax.media.opengl.awt.GLCanvas; //导入方法依赖的package包/类
protected void initGLCanvas() {
    device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();

    GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
    caps.setHardwareAccelerated(true);
    caps.setDoubleBuffered(true);
    caps.setStencilBits(settings.getStencilBits());
    caps.setDepthBits(settings.getDepthBits());

    if (settings.getSamples() > 1) {
        caps.setSampleBuffers(true);
        caps.setNumSamples(settings.getSamples());
    }

    canvas = new GLCanvas(caps) {
        @Override
        public void addNotify() {
            super.addNotify();
            onCanvasAdded();
        }

        @Override
        public void removeNotify() {
            onCanvasRemoved();
            super.removeNotify();
        }
    };
    // TODO: add a check on the settings
    // set the size of the canvas as early as possible to avoid further useless reshape attempts
    canvas.setSize(settings.getWidth(), settings.getHeight());
    if (settings.isVSync()) {
        GLContext.getCurrentGL().setSwapInterval(1);
    }
    canvas.setFocusable(true);
    canvas.setIgnoreRepaint(true);
    canvas.addGLEventListener(this);

    // N.B: it is too early to get the GL instance from the canvas
    // if (false){
    // trace mode
    // jME already uses err stream, use out instead
    // gl = new TraceGL(gl, System.out);
    // }else if (false){
    // debug mode
    // gl = new DebugGL(gl);
    // }else{
    // production mode
    // }
    renderer = new JoglRenderer();
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:51,代码来源:JoglAbstractDisplay.java


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