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