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


Java GLCanvas.addGLEventListener方法代码示例

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


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

示例1: startNewWindows

import com.jogamp.opengl.awt.GLCanvas; //导入方法依赖的package包/类
public void startNewWindows() {

	      //getting the capabilities object of GL2 profile
	      final GLProfile profile = GLProfile.get( GLProfile.GL2 );
	      GLCapabilities capabilities = new GLCapabilities(profile);

	      // The canvas
	      final GLCanvas glcanvas = new GLCanvas( capabilities );
	      triview = new Triangulation3DViewer(chip.getCanvas());
	      glcanvas.addGLEventListener( triview);
	      glcanvas.setSize( 800, 800 );

	      //creating frame
	      final JFrame frame = new JFrame (" triangulation 3D renderer");

	      //adding canvas to it
	      frame.getContentPane().add( glcanvas );
	      frame.setSize(frame.getContentPane().getPreferredSize() );
	      frame.setVisible( true );
	   }
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:21,代码来源:trackerForJoints.java

示例2: main

import com.jogamp.opengl.awt.GLCanvas; //导入方法依赖的package包/类
public static void main(String[] args) {
	// getting the capabilities object of GL2 profile
	final GLProfile profile = GLProfile.get(GLProfile.GL2);
	GLCapabilities glc = new GLCapabilities(profile);
	final GLCanvas glCanvas = new GLCanvas(glc);

	GameIntro b = new GameIntro();
	glCanvas.addGLEventListener(b);
	glCanvas.setSize(1300, 800);
	// creating frame
	final JFrame frame = new JFrame("Welcome to Heavy Evil");
	// adding canvas to it
	frame.getContentPane().add(glCanvas);
	frame.setSize(frame.getContentPane().getPreferredSize());
	frame.setVisible(true);

	final FPSAnimator animator = new FPSAnimator(glCanvas, 120, true);
	animator.start();
	
	glCanvas.isDoubleBuffered();

}
 
开发者ID:GettingNifty,项目名称:Heavy-Evil,代码行数:23,代码来源:GameIntro.java

示例3: GltfViewerJogl

import com.jogamp.opengl.awt.GLCanvas; //导入方法依赖的package包/类
/**
 * Creates a new GltfViewerJogl
 */
public GltfViewerJogl()
{
    GLProfile profile = getGLProfile();
    logger.config("GLProfile: " + profile);

    GLCapabilities capabilities = new GLCapabilities(profile);
    capabilities.setNumSamples(2);
    capabilities.setSampleBuffers(true);
    
    glComponent = new GLCanvas(capabilities);
    glComponent.addGLEventListener(glEventListener);
    
    // Without setting the minimum size, the canvas cannot 
    // be resized when it is embedded in a JSplitPane
    glComponent.setMinimumSize(new Dimension(10, 10));
    
    glContext = new GlContextJogl();
}
 
开发者ID:javagl,项目名称:JglTF,代码行数:22,代码来源:GltfViewerJogl.java

示例4: Shoot

import com.jogamp.opengl.awt.GLCanvas; //导入方法依赖的package包/类
Shoot()
{	
	System.out.printf("THREAD_COUNT:%4d\n", THREAD_COUNT);
	GLProfile glp = GLProfile.getDefault();
	GLCapabilities caps = new GLCapabilities(glp);
	caps.setSampleBuffers(true);
	caps.setNumSamples(8);
	
	canvas = new GLCanvas(caps);
	canvas.setSize(1000, 1000);
	canvas.addMouseListener(mcontrol);
	canvas.addKeyListener(kbcontrol);
	
	disp = new Display(this);
	disp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	disp.setSize(1000,1000);
	disp.add(canvas);
	disp.setVisible(true);
	disp.addKeyListener(kbcontrol);
	
	canvas.addGLEventListener(disp);
	animator = new FPSAnimator(canvas, 50);
	
	mtProjectiles = new MT_Generic<Projectile>(entityWrapper.projectiles, es);
	mtDynamics = new MT_Generic<Dynamic>(entityWrapper.dynamics, es);
	mtEntMov = new MT_EntMovement(entityWrapper.pathEnts, es);
	
	inst = this;
}
 
开发者ID:ben-j-c,项目名称:TopDownGame,代码行数:30,代码来源:Shoot.java

示例5: main

import com.jogamp.opengl.awt.GLCanvas; //导入方法依赖的package包/类
public static void main(String[] args)
	{
		
		System.setProperty("sun.awt.noerasebackground", "true");
		
		SimpleScene scene = new SimpleScene();

		Button button = new Button(20, 20, 50, 20, "123456");
		button.setFontSize(60);
		MoveablePanel panel = new MoveablePanel(10, 10, 300, 300);
		panel.setName("Yellow Panel");
		panel.setBackground(Color.YELLOW);
		panel.addChild(button);
//		//Label label = new Label("Test Label", 100, 100);
//		//panel.addChild(label);
//		//CheckBox cb = new CheckBox(250, 100);
//		//ComboBox cb = new ComboBox(250, 100);
//		//panel.addChild(cb);
		scene.addChild(panel);
		
		GLProfile glp = GLProfile.getDefault();
		GLCapabilities caps = new GLCapabilities(glp);
		GLCanvas canvas = new GLCanvas(caps);
		canvas.addGLEventListener(scene);
		
		JFrame frame = new JFrame("A Window");
		frame.setSize(700, 700);
		frame.setVisible(true);
		frame.add(canvas);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		canvas.addMouseListener(scene);
		canvas.addMouseMotionListener(scene);
		
		FPSAnimator animator = new FPSAnimator(canvas, 60);
		animator.start();
		
	}
 
开发者ID:carterg,项目名称:GLGUI,代码行数:38,代码来源:Test.java

示例6: main

import com.jogamp.opengl.awt.GLCanvas; //导入方法依赖的package包/类
public static void main(String[] args) {
    Frame frame = new Frame("Delaunay Triangulation Example");
    frame.setResizable(false);

    GLCapabilities caps = new GLCapabilities(GLProfile.get("GL2"));
    caps.setSampleBuffers(true);
    caps.setNumSamples(8);

    GLCanvas canvas = new GLCanvas(caps);

    DelaunayTriangulationExample ex = new DelaunayTriangulationExample();
    MouseListener lister = ex;
    canvas.addGLEventListener(ex);
    canvas.setPreferredSize(DIMENSION);
    canvas.addMouseListener(lister);

    frame.add(canvas);

    final FPSAnimator animator = new FPSAnimator(canvas, 25);

    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            new Thread(new Runnable() {
                public void run() {
                    animator.stop();
                    System.exit(0);
                }
            }).start();
        }
    });

    frame.setVisible(true);
    frame.pack();
    animator.start();
}
 
开发者ID:jdiemke,项目名称:delaunay-triangulator,代码行数:36,代码来源:DelaunayTriangulationExample.java

示例7: MainWindow

import com.jogamp.opengl.awt.GLCanvas; //导入方法依赖的package包/类
/**
 * Constructor.
 * @param width the width of the window in pixels
 * @param height the height of the window in pixels
 */
public MainWindow(int width, int height) {
    GLProfile glp = GLProfile.get(GLProfile.GL2);
    GLCapabilities caps = new GLCapabilities(glp);

    canvas = new GLCanvas(caps);

    frame = new Frame();
    frame.setSize(width, height);
    frame.add(canvas);
    frame.setVisible(true);

    frame.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            LOGGER.info("Window closing event");
            stop();
        }
    });

    mouseListener = new WindowMouseListener();
    keyListener = new WindowKeyListener();

    canvas.addGLEventListener(new GlEventHandler());
    canvas.addMouseListener(mouseListener);
    canvas.addMouseMotionListener(mouseListener);
    canvas.addMouseWheelListener(mouseListener);
    canvas.addKeyListener(keyListener);

    animator = new FPSAnimator(canvas, FRAMES_PER_SECOND);
    animator.start();
}
 
开发者ID:bensmith87,项目名称:ui,代码行数:38,代码来源:MainWindow.java

示例8: JavaSimpleLite_ImageSource

import com.jogamp.opengl.awt.GLCanvas; //导入方法依赖的package包/类
public JavaSimpleLite_ImageSource(NyARParam i_param, NyARCode i_ar_code,BufferedImage i_image) throws NyARRuntimeException,IOException
{
	this._ar_param = i_param;

	Frame frame = new Frame("NyARToolkit["+this.getClass().getName()+"]");
	// NyARToolkitの準備
	this._nya = NyARSingleDetectMarker.createInstance(this._ar_param, i_ar_code, 80.0,NyARSingleDetectMarker.PF_NYARTOOLKIT);
	this._nya.setContinueMode(false);// ここをtrueにすると、transMatContinueモード(History計算)になります。
	//load bitmap image
	this._src_image =new NyARBufferedImageRaster(i_image);
	
	// 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(i_image.getWidth() + ins.left + ins.right, i_image.getHeight() + ins.top + ins.bottom);
	canvas.setBounds(ins.left, ins.top, i_image.getWidth(), i_image.getHeight());
}
 
开发者ID:nyatla,项目名称:NyARToolkit,代码行数:28,代码来源:JavaSimpleLite_ImageSource.java

示例9: JavaSimpleLite

import com.jogamp.opengl.awt.GLCanvas; //导入方法依赖的package包/类
public JavaSimpleLite(NyARParam i_param, NyARCode i_ar_code) throws NyARRuntimeException
{
	this._ar_param = i_param;

	Frame frame = new Frame("NyARToolkit["+this.getClass().getName()+"]");

	
	// キャプチャの準備
	JmfCaptureDeviceList devlist = new JmfCaptureDeviceList();
	this._capture = devlist.getDevice(0);
	if (!this._capture.setCaptureFormat(SCREEN_X, SCREEN_Y, 30.0f)) {
		throw new NyARRuntimeException();
	}
	this._capture.setOnCapture(this);
	//JMFラスタオブジェクト
	this._cap_image = new JmfNyARRGBRaster(this._capture.getCaptureFormat());
	
	// NyARToolkitの準備
	this._nya = NyARSingleDetectMarker.createInstance(this._ar_param, i_ar_code, 80.0);
	this._nya.setContinueMode(true);// ここをtrueにすると、transMatContinueモード(History計算)になります。
	
	// 3Dを描画するコンポーネント
	GLCanvas canvas = new GLCanvas();
	frame.add(canvas);
	canvas.addGLEventListener(this);
	frame.addWindowListener(new WindowAdapter() {
		public void windowClosing(WindowEvent e)
		{
			_capture.stop();
			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,代码行数:39,代码来源:JavaSimpleLite.java

示例10: SingleARMarker

import com.jogamp.opengl.awt.GLCanvas; //导入方法依赖的package包/类
public SingleARMarker(NyARParam i_cparam) throws Exception
{
	JmfCaptureDeviceList devlist=new JmfCaptureDeviceList();
	this._ar_param=i_cparam;

	//キャプチャリソースの準備
	this._capture=devlist.getDevice(0);
	if(!this._capture.setCaptureFormat(SCREEN_X, SCREEN_Y,30.0f)){
		throw new NyARRuntimeException();
	}
	this._capture.setOnCapture(this);
	this._cap_image = new JmfNyARRGBRaster(this._capture.getCaptureFormat());	

	this._code_table[0]=NyARCode.loadFromARPattFile(new FileInputStream(CARCODE_FILE1),16,16);
	this._code_table[1]=NyARCode.loadFromARPattFile(new FileInputStream(CARCODE_FILE2),16,16);
	
	//OpenGLフレームの準備(OpenGLリソースの初期化、カメラの撮影開始は、initコールバック関数内で実行)
	Frame frame = new Frame("NyARToolkit["+this.getClass().getName()+"]");
	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);
	return;
}
 
开发者ID:nyatla,项目名称:NyARToolkit,代码行数:36,代码来源:SingleARMarker.java

示例11: SingleNyIdMarker

import com.jogamp.opengl.awt.GLCanvas; //导入方法依赖的package包/类
public SingleNyIdMarker(NyARParam i_cparam) throws NyARRuntimeException
{
	JmfCaptureDeviceList devlist=new JmfCaptureDeviceList();
	this._ar_param=i_cparam;

	//キャプチャリソースの準備
	this._capture=devlist.getDevice(0);
	if(!this._capture.setCaptureFormat(SCREEN_X, SCREEN_Y,30.0f)){
		throw new NyARRuntimeException();
	}
	this._capture.setOnCapture(this);
	this._cap_image = new JmfNyARRGBRaster(this._capture.getCaptureFormat());	
	
	//OpenGLフレームの準備(OpenGLリソースの初期化、カメラの撮影開始は、initコールバック関数内で実行)
	Frame frame = new Frame("NyARToolkit["+this.getClass().getName()+"]");
	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);
	return;
}
 
开发者ID:nyatla,项目名称:NyARToolkit,代码行数:33,代码来源:SingleNyIdMarker.java

示例12: SimpleLiteMStandard

import com.jogamp.opengl.awt.GLCanvas; //导入方法依赖的package包/类
public SimpleLiteMStandard(INyARMarkerSystemConfig i_config) throws NyARRuntimeException
{		
	JmfCaptureDeviceList devlist = new JmfCaptureDeviceList();
	JmfCaptureDevice d = devlist.getDevice(0);
	d.setCaptureFormat(i_config.getScreenSize(),30.0f);
	this._camera=new NyARJmfCamera(d);//create sensor system
	this._nyar=new NyARGlMarkerSystem(i_config);   //create MarkerSystem
	this.ids[0]=this._nyar.addARMarker(ARCODE_FILE2,16,25,80);
	this.ids[1]=this._nyar.addARMarker(ARCODE_FILE,16,25,80);
	
	Frame frame= new Frame("NyARTK program");
	frame.addWindowListener(new WindowAdapter() {
		public void windowClosing(WindowEvent e)
		{
			System.exit(0);
		}
	});
	GLCanvas canvas = new GLCanvas();
	frame.add(canvas);
	canvas.addGLEventListener(this);
	NyARIntSize s=i_config.getNyARSingleCameraView().getARParam().getScreenSize();

	frame.setVisible(true);
	Insets ins = frame.getInsets();
	frame.setSize(s.w + ins.left + ins.right,s.h + ins.top + ins.bottom);		
	canvas.setBounds(ins.left, ins.top, s.w,s.h);


	this._camera.start();
}
 
开发者ID:nyatla,项目名称:NyARToolkit,代码行数:31,代码来源:SimpleLiteMStandard.java

示例13: InitGL

import com.jogamp.opengl.awt.GLCanvas; //导入方法依赖的package包/类
void InitGL() {

        GLProfile kProfile = GLProfile.getMaxProgrammable(true);
        GLCapabilities kGlCapabilities = new GLCapabilities(kProfile);
        kGlCapabilities.setHardwareAccelerated(true);
        m_kCanvas = new GLCanvas(kGlCapabilities);
        m_kCanvas.setSize(g_imageWidth, g_imageHeight);
        m_kCanvas.addGLEventListener(this);
        m_kCanvas.addKeyListener(this);
        m_kCanvas.addMouseListener(this);
        m_kCanvas.addMouseMotionListener(this);
    }
 
开发者ID:java-opengl-labs,项目名称:oit,代码行数:13,代码来源:DualDepthPeeling.java

示例14: JCudaDriverVolumeRendererJOGL

import com.jogamp.opengl.awt.GLCanvas; //导入方法依赖的package包/类
/**
 * Creates a new JCudaTextureSample that displays the given volume
 * data, which has the specified size.
 * 
 * @param volumeData The volume data
 * @param sizeX The size of the data set in X direction
 * @param sizeY The size of the data set in Y direction
 * @param sizeZ The size of the data set in Z direction
 */
public JCudaDriverVolumeRendererJOGL(GLCapabilities capabilities,
    byte volumeData[], int sizeX, int sizeY, int sizeZ)
{
    this.simpleInteraction = new SimpleInteraction();
    
    h_volume = volumeData;
    volumeSize.x = sizeX;
    volumeSize.y = sizeY;
    volumeSize.z = sizeZ;

    width = 800;
    height = 800;

    // Initialize the GL component 
    glComponent = new GLCanvas(capabilities);
    glComponent.addGLEventListener(this);
    
    // Initialize the mouse controls
    MouseControl mouseControl = simpleInteraction.getMouseControl();
    glComponent.addMouseMotionListener(mouseControl);
    glComponent.addMouseWheelListener(mouseControl);

    // Create the main frame
    frame = new JFrame("JCuda 3D texture volume rendering sample");
    frame.addWindowListener(new WindowAdapter()
    {
        @Override
        public void windowClosing(WindowEvent e)
        {
            runExit();
        }
    });
    frame.setLayout(new BorderLayout());
    glComponent.setPreferredSize(new Dimension(width, height));
    frame.add(glComponent, BorderLayout.CENTER);
    frame.add(createControlPanel(), BorderLayout.SOUTH);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    
    // Create and start the animator
    animator = new Animator(glComponent);
    animator.setRunAsFastAsPossible(true);
    animator.start();
}
 
开发者ID:jcuda,项目名称:jcuda-samples,代码行数:55,代码来源:JCudaDriverVolumeRendererJOGL.java

示例15: JCudaDriverSimpleJOGL

import com.jogamp.opengl.awt.GLCanvas; //导入方法依赖的package包/类
/**
 * Creates a new JCudaDriverSimpleJOGL.
 * 
 * @param The JOGL OpenGL capabilities
 */
public JCudaDriverSimpleJOGL(GLCapabilities capabilities)
{
    simpleInteraction = new SimpleInteraction();
    
    // Initialize the GL component and the animator
    GLCanvas glComponent = new GLCanvas(capabilities);
    glComponent.setFocusable(true);
    glComponent.addGLEventListener(this);

    // Initialize the mouse and keyboard controls
    MouseControl mouseControl = simpleInteraction.getMouseControl();
    glComponent.addMouseMotionListener(mouseControl);
    glComponent.addMouseWheelListener(mouseControl);
    KeyboardControl keyboardControl = new KeyboardControl();
    glComponent.addKeyListener(keyboardControl);

    // Create the main frame 
    frame = new JFrame("JCuda / JOGL interaction sample");
    frame.addWindowListener(new WindowAdapter()
    {
        @Override
        public void windowClosing(WindowEvent e)
        {
            runExit();
        }
    });
    frame.setLayout(new BorderLayout());
    glComponent.setPreferredSize(new Dimension(800, 800));
    frame.add(glComponent, BorderLayout.CENTER);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    glComponent.requestFocus();

    // Create and start the animator
    animator = new Animator(glComponent);
    animator.setRunAsFastAsPossible(false);
    animator.start();
    
}
 
开发者ID:jcuda,项目名称:jcuda-samples,代码行数:46,代码来源:JCudaDriverSimpleJOGL.java


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