Texture.h 584 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11
#ifndef TEXTURE_H
#define TEXTURE_H

#include <GL/gl.h>
#include <QSharedPointer>

class Texture
{
public:
    Texture();

12 13 14 15
    void draw(float x1, float y1, float x2, float y2,
              bool smoothInterpolation) const;

private:
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
    enum State
    {
        UNINITIALIZED = 0,
        REQUESTED = 1,
        READY = 2
    };

    State state;

    GLuint textureId;

    int32_t textureWidth;
    int32_t textureHeight;

    int32_t imageWidth;
    int32_t imageHeight;

    float maxU;
    float maxV;
};

typedef struct QSharedPointer<Texture> TexturePtr;

#endif // TEXTURE_H