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


Java GLJPanel.addGLEventListener方法代码示例

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


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

示例1: OpenGLViewer

import javax.media.opengl.awt.GLJPanel; //导入方法依赖的package包/类
public OpenGLViewer (String title){
	super(title);
	panel = new GLJPanel();
	panel.addGLEventListener(this);
	panel.setPreferredSize(new Dimension(width, height));
	edu.stanford.rsl.conrad.cuda.MouseControl mouseControl = new edu.stanford.rsl.conrad.cuda.MouseControl(this);
	panel.addMouseMotionListener(mouseControl);
	panel.addMouseWheelListener(mouseControl);
	this.add(panel);
	pack();
	setVisible(true);
	boolean animate = true;
	if (animate) {
		animator = new Animator(panel);
		animator.setRunAsFastAsPossible(true);
		animator.start();
	}

	addWindowListener(new WindowAdapter()
	{
		public void windowClosing(WindowEvent e)
		{
			runExit();
		}
	});
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:27,代码来源:OpenGLViewer.java

示例2: main

import javax.media.opengl.awt.GLJPanel; //导入方法依赖的package包/类
public static void main(String[] args) {

		caps = new GLCapabilities(GLProfile.getGL2GL3());
		caps.setDoubleBuffered(true); // request double buffer display mode
		caps.setHardwareAccelerated(true);
		GLJPanel canvas = new GLJPanel();

		the_game myself = new the_game();
		canvas.addGLEventListener(myself);

		canvas.addKeyListener(myself);
		animator = new FPSAnimator(canvas, 60);

		JFrame frame = new JFrame("Grab Life by the Fireballs!");
		frame.setSize(width, height); // Size in pixels of the frame we draw on
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().add(canvas);
		frame.setVisible(true);
		canvas.requestFocusInWindow();
		myself.run();
	}
 
开发者ID:thomaj46,项目名称:GraphicsGame,代码行数:22,代码来源:the_game.java

示例3: start

import javax.media.opengl.awt.GLJPanel; //导入方法依赖的package包/类
public void start(){

		// Initialize the GL component 
		glComponentL = new GLJPanel();
		glComponentL.addGLEventListener(this);
		if (stereoMode)
		{
			glComponentR = new GLJPanel();
			glComponentR.addGLEventListener(this);
		}

		// Initialize the mouse controls
		MouseControl mouseControl = new MouseControl(this);
		glComponentL.addMouseMotionListener(mouseControl);
		glComponentL.addMouseWheelListener(mouseControl);


		frame.addWindowListener(new WindowAdapter()
		{
			public void windowClosing(WindowEvent e)
			{
				runExit();
			}
		});
		frame.setLayout(new BorderLayout());
		glComponentL.setPreferredSize(new Dimension(width, height));
		JPanel p = new JPanel(new GridLayout(1,1));
		p.add(glComponentL);
		if (stereoMode)
		{
			p.setLayout(new GridLayout(1,2));
			p.add(glComponentR);
		}
		frame.add(p, BorderLayout.CENTER);
		frame.add(createControlPanel(), BorderLayout.SOUTH);
		frame.pack();
		frame.setVisible(true);

		// Create and start the animator
		boolean animate = true;
		if (animate) {
			animatorL = new Animator(glComponentL);
			animatorL.setRunAsFastAsPossible(true);
			animatorL.start();
			if (stereoMode)
			{
				animatorR = new Animator(glComponentR);
				animatorR.setRunAsFastAsPossible(true);
				animatorR.start();
			}
		}
	}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:53,代码来源:JCudaDriverTextureSample.java

示例4: start

import javax.media.opengl.awt.GLJPanel; //导入方法依赖的package包/类
public void start(){

		// Initialize the GL component 
		glComponentL = new GLJPanel();
		glComponentL.addGLEventListener(this);
		if (stereoMode)
		{
			glComponentR = new GLJPanel();
			glComponentR.addGLEventListener(this);
		}

		// Initialize the mouse controls
		MouseControl mouseControl = new MouseControl(this);
		glComponentL.addMouseMotionListener(mouseControl);
		glComponentL.addMouseWheelListener(mouseControl);


		frame.addWindowListener(new WindowAdapter()
		{
			public void windowClosing(WindowEvent e)
			{
				runExit();
			}
		});
		frame.setLayout(new BorderLayout());
		glComponentL.setPreferredSize(new Dimension(width, height));
		JPanel p = new JPanel(new GridLayout(1,1));
		p.add(glComponentL);
		if (stereoMode)
		{
			p.setLayout(new GridLayout(1,2));
			p.add(glComponentR);
		}
		frame.add(p, BorderLayout.CENTER);
		frame.add(this.createControlPanel(), BorderLayout.SOUTH);
		frame.pack();
		frame.setVisible(true);

		// Create and start the animator
		boolean animate = true;
		if (animate) {
			animatorL = new Animator(glComponentL);
			animatorL.setRunAsFastAsPossible(true);
			animatorL.start();
			if (stereoMode)
			{
				animatorR = new Animator(glComponentR);
				animatorR.setRunAsFastAsPossible(true);
				animatorR.start();
			}
		}
	}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:53,代码来源:OpenCLTextureRendering.java


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