MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
Texture.h
1 /********************************************************************/
2 /* Copyright (c) 2015 DG Technologies Inc. and Yuzi Mizuno */
3 /* All rights reserved. */
4 /********************************************************************/
5 
10 #ifndef _mgTexture_HH
11 #define _mgTexture_HH
12 
13 #include "mg/MGCL.h"
14 
15 class MGImage;
16 class mgGLSLProgram;
17 
18 // @class mgTexture Texture.h "mgGL/Texture.h"
19 
21 
29 class MG_DLL_DECLR mgTexture{
30 
31 public:
32 
35  mgTexture(
36  GLenum target=GL_TEXTURE_2D
37  );
38 
39  ~mgTexture();
40 
43  void set_sampler(mgGLSLProgram* glsl, const std::string& samplerName);
44 
45  const std::string& getDefaultSamplerVariable()const;
46 
47 
61  void set_image(
62  GLsizei width
63  ,GLsizei height
64  ,const GLuint* pixels
65  ,bool mutableTexture=true
66  ,bool isPointSprite = false
67  ,GLint wrap=GL_REPEAT
68  ,GLint magminFilter=GL_LINEAR
71  );
75 
85  void set_image(
86  const MGImage& image
87  ,bool mutableTexture=true
88  ,bool isPointSprite=false
89  ,GLint wrap=GL_REPEAT
90  ,GLint magminFilter=GL_LINEAR
93  );
97 
99  void set_textureUnit(int textureUnit){m_textureUnit=textureUnit;};
100 
102  GLuint getTextureID()const{return m_textureID;};
103 
111  void use()const;
112 
113  GLsizei width()const{return m_width;};
114  GLsizei height()const{return m_height;};
115 
116 private:
117  GLsizei m_numberOfTextureLevels;//Currently this is set to 1.
118  GLsizei m_width, m_height;
119  GLenum m_target;
120 
122  int m_textureUnit;
123 
125  GLuint m_textureID;
126 
127  mutable int m_samplerLocation;
128 };
130 #endif
GLuint getTextureID() const
get texture ID
Definition: Texture.h:102
GLsizei width() const
Definition: Texture.h:113
MGImage defines bit map image data.
Definition: Image.h:26
GLsizei height() const
Definition: Texture.h:114
Texture definition class.
Definition: Texture.h:29
void set_textureUnit(int textureUnit)
When set_textureUnit is not invoked, m_textureUnit=0 is assumed.
Definition: Texture.h:99
mgGLSLProgramはOpenGL Shader Programをcompile , linkしてそのuniform変数の管理を行います.
Definition: glslprogram.h:151