當前位置: 首頁>>代碼示例>>Java>>正文


Java GLCapabilities.setSampleBuffers方法代碼示例

本文整理匯總了Java中javax.media.opengl.GLCapabilities.setSampleBuffers方法的典型用法代碼示例。如果您正苦於以下問題:Java GLCapabilities.setSampleBuffers方法的具體用法?Java GLCapabilities.setSampleBuffers怎麽用?Java GLCapabilities.setSampleBuffers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.media.opengl.GLCapabilities的用法示例。


在下文中一共展示了GLCapabilities.setSampleBuffers方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getCaps

import javax.media.opengl.GLCapabilities; //導入方法依賴的package包/類
private GLCapabilities getCaps() {
	GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());

	// Anti-aliasing using Multisampling
	if (AA_MULTISAMPLING) {
		try {
			caps.setAlphaBits(ALPHA_BITS);
			caps.setDoubleBuffered(true);
			caps.setHardwareAccelerated(true);
			caps.setSampleBuffers(true);
			caps.setNumSamples(8);

			caps.setAccumAlphaBits(ALPHA_BITS);
			caps.setAccumBlueBits(ALPHA_BITS);
			caps.setAccumGreenBits(ALPHA_BITS);
			caps.setAccumRedBits(ALPHA_BITS);

		} catch (javax.media.opengl.GLException ex) {
			ex.printStackTrace();
		}
	}

	return caps;
}
 
開發者ID:dev-cuttlefish,項目名稱:cuttlefish,代碼行數:25,代碼來源:NetworkRenderer.java

示例2: initUI

import javax.media.opengl.GLCapabilities; //導入方法依賴的package包/類
private void initUI() {

        this.width  = 600;
        this.height = 400;

        GLCapabilities config = new GLCapabilities(GLProfile.get(GLProfile.GL2));
        config.setSampleBuffers(true);
        config.setNumSamples(4);

        GLCanvas canvas = new GLCanvas(config);
        canvas.addGLEventListener(this);
        usi.init(canvas);

        JFrame frame = new JFrame("JOGL-JOCL Interoperability Example");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.add(canvas);
        frame.setSize(width, height);

        frame.setVisible(true);

    }
 
開發者ID:akmaier,項目名稱:CONRAD,代碼行數:22,代碼來源:GLCLInteroperabilityDemo.java

示例3: MainWindow

import javax.media.opengl.GLCapabilities; //導入方法依賴的package包/類
public MainWindow(CSpaceViewer viewer) {
  GLProfile glp = GLProfile.get(GLProfile.GL2);
  GLCapabilities glc = new GLCapabilities(glp);
  glc.setSampleBuffers(true);
  glc.setNumSamples(8);
  glc.setDepthBits(32);
  canvas = new GLCanvas(glc);
  animator = new FPSAnimator(canvas, 60);

  toolBar = new MainToolBar(viewer);

  setTitle("Configuration Space Visualization");
  setLayout(new BorderLayout());
  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  setSize(1280, 720);
  setLocationRelativeTo(null);

  getContentPane().add(toolBar, BorderLayout.SOUTH);
  getContentPane().add(canvas, BorderLayout.CENTER);

  canvas.addGLEventListener(emptyScene);
  animator.start();
}
 
開發者ID:jstoecker,項目名稱:cspace,代碼行數:24,代碼來源:MainWindow.java

示例4: init

import javax.media.opengl.GLCapabilities; //導入方法依賴的package包/類
private void init(GLComponentType glComponentType, GLProfile profile, Map3DModel model) {
    GLCapabilities caps = new GLCapabilities(profile);
    // use sample buffers for antialiasing
    caps.setSampleBuffers(true);
    // set the number of supersampling for antialising
    caps.setNumSamples(Map3DOptionsPanel.getAntialiasingLevel());

    if (glComponentType == GLComponentType.GL_Swing) {
        this.component = new GLJPanel(caps);
    } else {
        this.component = new GLCanvas(caps);
    }
    this.drawable = (GLAutoDrawable)this.component;
    this.component.setSize(1024, 768);
    //((Component) this.component).setIgnoreRepaint(true);
    this.drawable.addGLEventListener(this);

    if (model == null) {
        model = new Map3DModelVBOShader();
        if (!model.canRun()) {
            model = new Map3DModelVBO();
        }
        if (!model.canRun()) {
            model = new Map3DModelVertexArrays();
        }
    }
    //model = new Map3DModelVertexArrays();
    this.model = model;

    this.texture = new Map3DTexture();
    this.setAnimation(new Map3DRotationAnimation(this.drawable));

    mouseHandler = new Map3DMouseHandler(this);
    this.component.addMouseMotionListener(mouseHandler);
    this.component.addMouseListener(mouseHandler);
    this.component.addMouseWheelListener(mouseHandler);
}
 
開發者ID:OSUCartography,項目名稱:TerrainViewer,代碼行數:38,代碼來源:Map3DViewer.java

示例5: NeonNewtWindow

import javax.media.opengl.GLCapabilities; //導入方法依賴的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

示例6: initGLCanvas

import javax.media.opengl.GLCapabilities; //導入方法依賴的package包/類
protected void initGLCanvas(){
        device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();

        GLCapabilities caps = new GLCapabilities();
        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();
            }
        };
        if (settings.isVSync()){
            canvas.getGL().setSwapInterval(1);
        }
        canvas.setFocusable(true);
        canvas.setIgnoreRepaint(true);
        canvas.addGLEventListener(this);

        GL gl = canvas.getGL();
//        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(gl);
    }
 
開發者ID:chototsu,項目名稱:MikuMikuStudio,代碼行數:47,代碼來源:JoglAbstractDisplay.java

示例7: initGLCanvas

import javax.media.opengl.GLCapabilities; //導入方法依賴的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.GLCapabilities.setSampleBuffers方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。