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


Java GLCapabilities.setStencilBits方法代碼示例

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


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

示例1: Quantum

import javax.media.opengl.GLCapabilities; //導入方法依賴的package包/類
public Quantum( )
{
	GLCapabilities caps = new GLCapabilities();
	caps.setRedBits(8);
   	caps.setGreenBits(8);
   	caps.setBlueBits(8);
   	caps.setAlphaBits(8);
   	caps.setDepthBits(16);
   	caps.setStencilBits(8);    	
   	caps.setDoubleBuffered(true);    	
       canvas = new GLCanvas( caps );      
       canvas.addGLEventListener(this);       
            
       SoundManager.setBufferVolume( config.getVolumeSfx() );        
       setBounds( config.getX(), config.getY(), config.getWidth(), config.getHeight() );        
       setTitle("QUANTUM");        
       try {
		this.setIconImage( ImageIO.read( FileManager.readFile( "icon.png" ) ) );
	} catch (Exception e1) {
		Log.println( "[Quantum] couldn't 'load icon.png'" );
	}

       getContentPane().add(canvas,BorderLayout.CENTER);
       
       animator = new Animator( canvas );
       animator.setRunAsFastAsPossible( true );
       animator.start();               
       

       addWindowListener(new WindowAdapter()
       {
           public void windowClosing(WindowEvent e)
           {            	
           	remove(canvas);
           	animator.stop();
           	closing( );
               System.exit(0);
           }
       });
}
 
開發者ID:weimingtom,項目名稱:quantum-game,代碼行數:41,代碼來源:Quantum.java

示例2: setupAviatrix

import javax.media.opengl.GLCapabilities; //導入方法依賴的package包/類
/**
 * Setup the avaiatrix pipeline here
 */
private void setupAviatrix()
{
    // Assemble a simple single-threaded pipeline.
    GLCapabilities caps = new GLCapabilities();
    caps.setStencilBits(8);
    caps.setDoubleBuffered(true);
    caps.setHardwareAccelerated(true);

    GraphicsCullStage culler = new NullCullStage();
    culler.setOffscreenCheckEnabled(false);

    GraphicsSortStage sorter = new NullSortStage();
    surface = new DebugAWTSurface(caps);
    DefaultGraphicsPipeline pipeline = new DefaultGraphicsPipeline();

    pipeline.setCuller(culler);
    pipeline.setSorter(sorter);
    pipeline.setGraphicsOutputDevice(surface);

    displayManager = new SingleDisplayCollection();
    displayManager.addPipeline(pipeline);

    // Render manager
    sceneManager = new SingleThreadRenderManager();
    sceneManager.addDisplay(displayManager);
    sceneManager.setMinimumFrameInterval(100);

    // Before putting the pipeline into run mode, put the canvas on
    // screen first.
    Component comp = (Component)surface.getSurfaceObject();
    add(comp, BorderLayout.CENTER);
}
 
開發者ID:Norkart,項目名稱:NK-VirtualGlobe,代碼行數:36,代碼來源:StencilDemo.java

示例3: LocalTest

import javax.media.opengl.GLCapabilities; //導入方法依賴的package包/類
public LocalTest( )
{		
	sim = new Simulation( true );
	
	for( int i = 0; i < 10; i++ )
	{
		Planet planet = new Planet( sim, new Vector2D( (float)Math.random() * 20000, (float)Math.random() *20000 ), 100,  1, 1, 1, 200 );
		planet.setOwner( 1 );
		sim.addObject( planet );			
		planet.spawnTree();
		planet.spawnTree();
		for( int j = 0; j < 100; j++ )
			planet.spawnCreature();
	}						
	
	GLCapabilities caps = new GLCapabilities();
	caps.setRedBits(8);
   	caps.setGreenBits(8);
   	caps.setBlueBits(8);
   	caps.setAlphaBits(8);
   	caps.setDepthBits(16);
   	caps.setStencilBits(8);
   	caps.setNumSamples( 8 );    	
   	caps.setDoubleBuffered(true);
       GLCanvas canvas = new GLCanvas( caps );      
       canvas.addGLEventListener(this);

       setSize(1024,1024);
       setTitle("CAV-Projekt: JOGL - Beispielszene");        

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

       final Animator animator = new Animator( canvas );
       animator.setRunAsFastAsPossible( true );
       animator.start();
       
       addWindowListener(new WindowAdapter()
       {
           public void windowClosing(WindowEvent e)
           {
           	animator.stop();            	
               System.exit(0);
           }
       });               
}
 
開發者ID:weimingtom,項目名稱:quantum-game,代碼行數:46,代碼來源:LocalTest.java

示例4: 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

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