📄 texture.h
字号:
#ifndef TGALOADER_H
#define TGALOADER_H
#include <windows.h>
#include <GLES/gl.h>
class Texture
{
public:
Texture(const char *textureFileName, GLenum minFilter = GL_LINEAR,GLenum magFilter = GL_LINEAR,GLenum wrapS = GL_REPEAT,GLenum wrapT = GL_REPEAT, int width = 128, int height = 128, int bpp = 24);
~Texture();
inline void BindTexture() const {glBindTexture(GL_TEXTURE_2D, m_id);}; //Set the texture active for the current context
inline GLuint GetID() const {return m_id;}; //returns the OpenGL ES texture handle
inline bool GetState() const {return m_state;}; //returns the texture's creation state
private:
bool LoadTGA(const char *textureFileName,GLubyte **pixels); //loads a tga texture (uncompressed, and with 24 or 32 bits)
bool LoadRaw(const char *textureFileName,GLubyte **pixels,int width, int height, int bpp); //loads a raw texture
void FlipBitmapVertical(GLubyte *data,int format); //flips vertically a GLubyte array, useful for raw textures, because they turned upside down
bool m_state;
int m_width, m_height;
GLuint m_id;
GLenum m_minFilter, m_magFilter;
GLenum m_wrapS, m_wrapT;
GLenum m_format;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -