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 NyARException(); } this._capture.setOnCapture(this); this._cap_image = new JmfNyARRGBRaster(this._capture.getCaptureFormat()); this._code_table[0] = NyARCode.createFromARPattFile(new FileInputStream(CARCODE_FILE1), 16, 16); this._code_table[1] = NyARCode.createFromARPattFile(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; }
public static void main(final String[] argv) { final Frame frame = new Frame("Cg demo (runtime_ogl_vertex_fragment)"); final GLCanvas canvas = new GLCanvas(); canvas.addGLEventListener(new runtime_ogl_vertex_fragment()); frame.add(canvas); frame.setSize(512, 512); final Animator animator = new Animator(canvas); frame.addWindowListener( new WindowAdapter() { @Override public void windowClosing(@SuppressWarnings("unused") final WindowEvent e) { // Run this on another thread than the AWT event queue to // make sure the call to Animator.stop() completes before // exiting new Thread( new Runnable() { public void run() { animator.stop(); System.exit(0); } }) .start(); } }); frame.setVisible(true); animator.start(); // and all the rest happens in the display function... }
public SimpleLiteMStandard(INyARMarkerSystemConfig i_config) throws NyARException { 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.getNyARParam().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(); }
public static void main(String[] args) { Frame frame = new Frame("Simple JOGL Application"); GLCanvas canvas = new GLCanvas(); canvas.addGLEventListener(new Project1()); frame.add(canvas); frame.setSize(600, 600); final Animator animator = new Animator(canvas); frame.addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { new Thread( new Runnable() { public void run() { animator.stop(); System.exit(0); } }) .start(); } }); frame.setVisible(true); animator.start(); }
public Teste() { super("colormatrix"); caps = new GLCapabilities(); canvas = new GLCanvas(caps); canvas.addGLEventListener(this); canvas.addKeyListener(this); add(canvas); }