tibia-client/src/framework/graphics/texture.h

35 lines
853 B
C
Raw Normal View History

#ifndef TEXTURE_H
#define TEXTURE_H
2011-08-14 04:09:11 +02:00
#include "graphicsdeclarations.h"
class Texture : public std::enable_shared_from_this<Texture>
{
public:
2010-11-23 16:30:43 +01:00
/// Create a texture, width and height must be a multiple of 2
2011-08-14 04:09:11 +02:00
Texture(int width, int height, int channels, uchar* pixels = NULL);
virtual ~Texture();
/// Enable texture bilinear filter (smooth scaled textures)
2011-05-13 01:24:57 +02:00
virtual void enableBilinearFilter();
2011-04-10 17:37:15 +02:00
/// Get OpenGL texture id
2011-05-13 01:24:57 +02:00
virtual uint getTextureId() const { return m_textureId; }
2011-04-10 17:37:15 +02:00
/// Copy pixels from OpenGL texture
2011-08-14 04:09:11 +02:00
uchar* getPixels();
2011-04-10 17:37:15 +02:00
const Size& getSize() const { return m_size; }
const Size& getGlSize() const { return m_glSize; }
2011-04-10 17:37:15 +02:00
2011-05-13 01:24:57 +02:00
protected:
Texture() { }
2011-08-14 04:09:11 +02:00
uint internalLoadGLTexture(uchar* pixels, int channels, int w, int h);
2011-04-06 22:18:00 +02:00
uint m_textureId;
Size m_size;
Size m_glSize;
};
2011-08-14 04:09:11 +02:00
#endif