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


Java GLWindow.setSurfaceScale方法代码示例

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


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

示例1: 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();
}
 
开发者ID:philjord,项目名称:3DTools,代码行数:78,代码来源:GPUUISceneNewtDemo.java


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