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


Java GLCanvas.addGLEventListener方法代码示例

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


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

示例1: JavaSimpleLite_Quad

import javax.media.opengl.GLCanvas; //导入方法依赖的package包/类
public JavaSimpleLite_Quad()
{
	Frame frame = new Frame("Java simpleLite with NyARToolkit");

	// 3Dを描画するコンポーネント
	GLCanvas canvas = new GLCanvas();
	frame.add(canvas);
	canvas.addGLEventListener(this);
	frame.addWindowListener(new WindowAdapter() {
		public void windowClosing(WindowEvent e)
		{
			System.exit(0);
		}
	});

	frame.setVisible(true);
	Insets ins = frame.getInsets();
	frame.setSize(SCREEN_X + ins.left + ins.right, SCREEN_Y + ins.top + ins.bottom);
	canvas.setBounds(ins.left, ins.top, SCREEN_X, SCREEN_Y);
}
 
开发者ID:nyatla,项目名称:NyARToolkit,代码行数:21,代码来源:JavaSimpleLite_Quad.java

示例2: JavaSimpleLite_X2

import javax.media.opengl.GLCanvas; //导入方法依赖的package包/类
public JavaSimpleLite_X2()
{
	NyMath.initialize();
	Frame frame = new Frame("Java simpleLite with NyARToolkit");

	// 3Dを描画するコンポーネント
	GLCanvas canvas = new GLCanvas();
	frame.add(canvas);
	canvas.addGLEventListener(this);
	frame.addWindowListener(new WindowAdapter() {
		public void windowClosing(WindowEvent e)
		{
			System.exit(0);
		}
	});

	frame.setVisible(true);
	Insets ins = frame.getInsets();
	frame.setSize(SCREEN_X + ins.left + ins.right, SCREEN_Y + ins.top + ins.bottom);
	canvas.setBounds(ins.left, ins.top, SCREEN_X, SCREEN_Y);
}
 
开发者ID:nyatla,项目名称:NyARToolkit,代码行数:22,代码来源:JavaSimpleLite_X2.java

示例3: GForceVis

import javax.media.opengl.GLCanvas; //导入方法依赖的package包/类
public GForceVis()
{

	super("G-Force-Visualization");

	setSize(800, 600);
	// setDefaultCloseOperation(this.EXIT_ON_CLOSE);

	// Canvas
	canvas = new GLCanvas(new GLCapabilities());
	canvas.addGLEventListener(this);
	// KeyListener
	canvas.addKeyListener(this);
	canvas.addMouseListener(this);
	canvas.addMouseMotionListener(this);

	GForceMenuBar gfMenuBar = new GForceMenuBar();

	setLayout(new BorderLayout());
	add(canvas, BorderLayout.CENTER);
	add(gfMenuBar.getMenuBar(), BorderLayout.WEST);
}
 
开发者ID:iSchluff,项目名称:Wii-Gesture,代码行数:23,代码来源:GForceVis.java

示例4: makeRenderPanel

import javax.media.opengl.GLCanvas; //导入方法依赖的package包/类
private JPanel makeRenderPanel(int fps) {
	
	// specify the features we want, if necessary
	//GLCapabilities caps = new GLCapabilities();
	
	// create the openGL canvas
	GLCanvas canvas = new GLCanvas();       // comment out if passing in capabilities
	//GLCanvas canvas = new GLCanvas(caps); // uncomment if passing in capabilities
	
	// add the listener for openGL callbacks	
    canvas.addGLEventListener(listener);
	
	// create the animator which will call our display callback at a fixed frame rate
	animator = new FPSAnimator(canvas, fps, true);
	
	// create the enclosing panel for the canvas
	JPanel renderPanel = new JPanel();
	renderPanel.setLayout( new BorderLayout() );
	renderPanel.setPreferredSize( new Dimension(800, 600) );
	renderPanel.add(canvas, BorderLayout.CENTER);
	
	return renderPanel;
}
 
开发者ID:sddaniels,项目名称:wongs-wiivenge,代码行数:24,代码来源:GameWindow.java

示例5: Quantum

import javax.media.opengl.GLCanvas; //导入方法依赖的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

示例6: MainWindow

import javax.media.opengl.GLCanvas; //导入方法依赖的package包/类
public MainWindow()
{
	super("3D-Visualization");
	
	preferences = new Preferences();
	
	//WindowSize
	setSize(preferences.getWindowWidth(), preferences.getWindowHeight());
	//ClosingOperation
	setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	
	addMouseWheelListener(this);
	
	
	//Canvas
	canvas = new GLCanvas(new GLCapabilities());
	canvas.addGLEventListener(this);
	//KeyListener
	canvas.addKeyListener(this);
	canvas.addMouseListener(this);
	canvas.addMouseMotionListener(this);

	//MENU
	Menu menu = new Menu(preferences);
	JScrollPane scrollPane = menu.getScrollPane();
	
	//StatusBar
	JPanel statusPanel = menu.getStatusPanel();
	
	menu.initMenuLogic();
	
	setLayout(new BorderLayout());
	add(menu.getMenuBar(),BorderLayout.NORTH);
	add(canvas,BorderLayout.CENTER);
	add(scrollPane,BorderLayout.WEST);
	add(statusPanel,BorderLayout.SOUTH);

}
 
开发者ID:iSchluff,项目名称:Wii-Gesture,代码行数:39,代码来源:MainWindow.java

示例7: LocalTest

import javax.media.opengl.GLCanvas; //导入方法依赖的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

示例8: initGLCanvas

import javax.media.opengl.GLCanvas; //导入方法依赖的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


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