Program Listing for File GlTexture.hpp

Return to documentation for file (include/lvr2/display/GlTexture.hpp)

#ifndef LVR2_GLTEXTURE_HPP_
#define LVR2_GLTEXTURE_HPP_

#include <string>
using std::string;

#ifdef _MSC_VER
#include <Windows.h>
#endif

#ifndef __APPLE__
#include <GL/gl.h>
#else
#include <OpenGL/gl.h>
#endif

#include "lvr2/texture/Texture.hpp"

namespace lvr2
{

class GlTexture
{
public:

    GlTexture(unsigned char* pixels, int width, int height);

    GlTexture(const GlTexture &other);

    GlTexture(const Texture &other);

    GlTexture() : m_pixels(0), m_texIndex(0) {};

    virtual ~GlTexture();

    void bind() const { glBindTexture(GL_TEXTURE_2D, m_texIndex);}

    void upload();

    int                 m_width;

    int                 m_height;

    unsigned char*      m_pixels;

    GLuint              m_texIndex;
};

} // namespace lvr2

#endif /* TEXTURE_HPP_ */