|
MGCL V10
V10
MGCL V10
|
Texture definition class. [詳解]
公開メンバ関数 | |
| mgTexture (GLenum target=GL_TEXTURE_2D) | |
| ~mgTexture () | |
| void | set_sampler (mgGLSLProgram *glsl, const std::string &samplerName) |
| const std::string & | getDefaultSamplerVariable () const |
| void | set_image (GLsizei width, GLsizei height, const GLuint *pixels, bool mutableTexture=true, bool isPointSprite=false, GLint wrap=GL_REPEAT, GLint magminFilter=GL_LINEAR) |
| void | set_image (const MGImage &image, bool mutableTexture=true, bool isPointSprite=false, GLint wrap=GL_REPEAT, GLint magminFilter=GL_LINEAR) |
| void | set_textureUnit (int textureUnit) |
| When set_textureUnit is not invoked, m_textureUnit=0 is assumed. [詳解] | |
| GLuint | getTextureID () const |
| get texture ID [詳解] | |
| void | use () const |
| GLsizei | width () const |
| GLsizei | height () const |
Texture definition class.
Before use of mgTexture, set_image must be invoked, and set_sampler is optionally invoked. If set_sampler is not invoked, uniform of spampler2D "texture1" is assumed. Since mgTexture does not invoke glUseProgram(mgGLSLProgram's use() function) the current program's uniform variable texture1(or the variable set by set_sampler) must be spamler2D. When set_textureUnit is not invoked, unit number 0 is assumed.
| mgTexture::mgTexture | ( | GLenum | target = GL_TEXTURE_2D | ) |
デフォルトコンストラクター Before use of mgTexture, set_image and set_sampler must be invoked.
| target | Currently only GL_TEXTURE_2D is allowed. |
| mgTexture::~mgTexture | ( | ) |
| const std::string& mgTexture::getDefaultSamplerVariable | ( | ) | const |
|
inline |
get texture ID
|
inline |
| void mgTexture::set_image | ( | GLsizei | width, |
| GLsizei | height, | ||
| const GLuint * | pixels, | ||
| bool | mutableTexture = true, |
||
| bool | isPointSprite = false, |
||
| GLint | wrap = GL_REPEAT, |
||
| GLint | magminFilter = GL_LINEAR |
||
| ) |
image データをtextureにセットする
| width | ビットマップデータの横幅。ピクセル幅 |
| height | ビットマップデータの縦幅。 |
| pixels | RGBA バイト列。各整数の上位バイトが A 値。 |
| mutableTexture | true if mutable, false, if immutable. |
| isPointSprite | true if point sprite. |
| wrap | GL_TEXTURE_WRAP_S&GL_TEXTURE_WRAP_Tに指定するparameterを指定 GL_REPEAT, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER, GL_MIRRORED_REPEAT, or GL_MIRROR_CLAMP_TO_EDGEGL_REPEAT. |
| magminFilter | GL_TEXTURE_MAG_FILTER&GL_TEXTURE_MIN_FILTERに 指定するparameterを指定する:GL_NEAREST,GL_LINEAR,GL_NEAREST_MIPMAP_NEAREST, GL_LINEAR_MIPMAP_NEAREST,GL_NEAREST_MIPMAP_LINEAR,GL_LINEAR_MIPMAP_LINEAR いずれか。GL_TEXTURE_MAG_FILTER&GL_TEXTURE_MIN_FILTER双方に同じ値がセットされる。 |
| void mgTexture::set_image | ( | const MGImage & | image, |
| bool | mutableTexture = true, |
||
| bool | isPointSprite = false, |
||
| GLint | wrap = GL_REPEAT, |
||
| GLint | magminFilter = GL_LINEAR |
||
| ) |
Set the image data from other MGImage. This type of set_image uses image.width(), .height(), and .image(), and invoke above set_image. set_image() invokes:
| image | Original image. |
| mutableTexture | true if mutable, false, if immutable. |
| isPointSprite | true if point sprite. |
| wrap | GL_TEXTURE_WRAP_S&GL_TEXTURE_WRAP_Tに指定するparameterを指定 GL_REPEAT, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER, GL_MIRRORED_REPEAT, or GL_MIRROR_CLAMP_TO_EDGEGL_REPEAT. |
| magminFilter | GL_TEXTURE_MAG_FILTER&GL_TEXTURE_MIN_FILTERに 指定するparameterを指定する:GL_NEAREST,GL_LINEAR,GL_NEAREST_MIPMAP_NEAREST, GL_LINEAR_MIPMAP_NEAREST,GL_NEAREST_MIPMAP_LINEAR,GL_LINEAR_MIPMAP_LINEAR いずれか。GL_TEXTURE_MAG_FILTER&GL_TEXTURE_MIN_FILTER双方に同じ値がセットされる。 |
| void mgTexture::set_sampler | ( | mgGLSLProgram * | glsl, |
| const std::string & | samplerName | ||
| ) |
Set the glsl program and sampler variable name of *****glUseProgram() is not invoked, glsl must be the current program.
|
inline |
When set_textureUnit is not invoked, m_textureUnit=0 is assumed.
| void mgTexture::use | ( | ) | const |
Use this texture after set_image and set_sampler are invoked. Use() will invoke OpenGL:
|
inline |