2 * PROJECT: NyARToolkit JOGL utilities.
\r
3 * --------------------------------------------------------------------------------
\r
4 * This work is based on the original ARToolKit developed by
\r
7 * HITLab, University of Washington, Seattle
\r
8 * http://www.hitl.washington.edu/artoolkit/
\r
10 * The NyARToolkit is Java edition ARToolKit class library.
\r
11 * Copyright (C)2008-2009 Ryo Iizuka
\r
13 * This program is free software: you can redistribute it and/or modify
\r
14 * it under the terms of the GNU General Public License as published by
\r
15 * the Free Software Foundation, either version 3 of the License, or
\r
16 * (at your option) any later version.
\r
18 * This program is distributed in the hope that it will be useful,
\r
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
21 * GNU General Public License for more details.
\r
23 * You should have received a copy of the GNU General Public License
\r
24 * along with this program. If not, see <http://www.gnu.org/licenses/>.
\r
26 * For further information please contact.
\r
27 * http://nyatla.jp/nyatoolkit/
\r
28 * <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>
\r
31 package jp.nyatla.nyartoolkit.jogl.utils;
\r
34 import javax.media.opengl.GL;
\r
36 import jp.nyatla.nyartoolkit.NyARException;
\r
37 import jp.nyatla.nyartoolkit.jmf.utils.*;
\r
38 import jp.nyatla.nyartoolkit.core.param.NyARParam;
\r
39 import jp.nyatla.nyartoolkit.core.rasterreader.*;
\r
40 import javax.media.format.*;
\r
43 * NyARRaster_RGBにOpenGL用のデータ変換機能を追加したものです。
\r
45 public class GLNyARRaster_RGB extends JmfNyARRaster_RGB
\r
47 private int _gl_flag;
\r
49 * コンストラクタです。i_formatを取り込めるi_paramのサイズパラメタを持つ
\r
52 * カメラパラメタを指定します。コンストラクタは、画面サイズ以外のパラメタを見ていません。
\r
54 * キャプチャ画像のピクセルフォーマットを指定します。
\r
55 * @throws NyARException
\r
57 public GLNyARRaster_RGB(NyARParam i_param,VideoFormat i_format) throws NyARException
\r
59 super(i_param.getScreenSize(),i_format);
\r
60 switch(this._reader.getBufferType()){
\r
61 case INyARBufferReader.BUFFERFORMAT_BYTE1D_B8G8R8_24:
\r
62 this._gl_flag = GL.GL_BGR;
\r
64 case INyARBufferReader.BUFFERFORMAT_BYTE1D_R8G8B8_24:
\r
65 this._gl_flag = GL.GL_RGB;
\r
68 throw new NyARException();
\r
73 * RGBバイト配列への参照値を返します。
\r
74 * バッファの並び順は、getGLPixelFlagが返すデータ順で格納されています。
\r
78 public byte[] getGLRgbArray()
\r
80 return (byte[])this._reader.getBuffer();
\r
84 * OpenGLの描画フラグを返します。
\r
85 * この値は、RGBバッファのバイト並びタイプです。
\r
87 * GL.GL_BGR等の、RGBバイト配列の形式を表す値です。
\r
89 public int getGLPixelFlag()
\r
91 return this._gl_flag;
\r