本文整理汇总了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();
}
});
}
示例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();
}
示例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();
}
}
}
示例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();
}
}
}