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.raster.*;
\r
40 import jp.nyatla.nyartoolkit.core.types.NyARBufferType;
\r
42 import javax.media.format.*;
\r
45 * NyARRaster_RGBにOpenGL用のデータ変換機能を追加したものです。
\r
47 public class GLNyARRaster_RGB extends JmfNyARRaster_RGB
\r
49 private int _gl_flag;
\r
51 * コンストラクタです。i_formatを取り込めるi_paramのサイズパラメタを持つ
\r
54 * カメラパラメタを指定します。コンストラクタは、画面サイズ以外のパラメタを見ていません。
\r
56 * キャプチャ画像のピクセルフォーマットを指定します。
\r
57 * @throws NyARException
\r
59 public GLNyARRaster_RGB(NyARParam i_param,VideoFormat i_format) throws NyARException
\r
61 super(i_param.getScreenSize(),i_format);
\r
62 initMember(this.getBufferType());
\r
65 public GLNyARRaster_RGB(int i_width,int i_height,VideoFormat i_format) throws NyARException
\r
67 super(i_width,i_height,i_format);
\r
68 initMember(this.getBufferType());
\r
71 private void initMember(int i_buffer_type) throws NyARException
\r
73 switch(i_buffer_type){
\r
74 case NyARBufferType.BYTE1D_B8G8R8_24:
\r
75 this._gl_flag = GL.GL_BGR;
\r
77 case NyARBufferType.BYTE1D_R8G8B8_24:
\r
78 this._gl_flag = GL.GL_RGB;
\r
81 throw new NyARException();
\r
86 * RGBバイト配列への参照値を返します。
\r
87 * バッファの並び順は、getGLPixelFlagが返すデータ順で格納されています。
\r
91 public byte[] getGLRgbArray()
\r
93 return (byte[])this.getBuffer();
\r
97 * OpenGLの描画フラグを返します。
\r
98 * この値は、RGBバッファのバイト並びタイプです。
\r
100 * GL.GL_BGR等の、RGBバイト配列の形式を表す値です。
\r
102 public int getGLPixelFlag()
\r
104 return this._gl_flag;
\r