Go to the documentation of this file.00001 #ifndef _IMAGE_TEXTURE_H_
00002 #define _IMAGE_TEXTURE_H_
00003
00004 #include "ofConstants.h"
00005 #include "ofGraphics.h"
00006
00007
00008 typedef struct{
00009
00010 bool bAllocated;
00011 int glType;
00012 int glTypeInternal;
00013 int textureTarget;
00014 float tex_t;
00015 float tex_u;
00016 float tex_w;
00017 float tex_h;
00018 float width;
00019 float height;
00020 bool bFlipTexture;
00021
00022
00023
00024
00025 union{
00026 struct{
00027 unsigned int textureID;
00028 };
00029 unsigned int textureName[1];
00030 };
00031
00032 }ofTextureData;
00033
00034
00035
00036 void ofEnableTextureEdgeHack();
00037 void ofDisableTectureEdgeHack();
00038
00039 class ofTexture : public ofBaseDraws{
00040
00041 public :
00042
00043 ofTexture();
00044 virtual ~ofTexture();
00045
00046
00047
00048
00049
00050
00051
00052 ofTexture(const ofTexture& mom);
00053 ofTexture& operator=(const ofTexture& mom);
00054
00055
00056 void allocate(int w, int h, int internalGlDataType);
00057 void allocate(int w, int h, int internalGlDataType, bool bUseARBExtention);
00058 void clear();
00059 void loadData(unsigned char * data, int w, int h, int glDataType);
00060 void loadScreenData(int x, int y, int w, int h);
00061
00062
00063
00064 void setAnchorPercent(float xPct, float yPct);
00065 void setAnchorPoint(int x, int y);
00066 void resetAnchor();
00067
00068 void draw(float x, float y, float w, float h);
00069 void draw(float x, float y);
00070
00071
00072 void bind();
00073 void unbind();
00074
00075 bool bAllocated();
00076
00077 ofTextureData getTextureData();
00078
00079 float getHeight();
00080 float getWidth();
00081
00082 ofTextureData texData;
00083 protected:
00084 ofPoint anchor;
00085 bool bAnchorIsPct;
00086
00087
00088 };
00089
00090 #endif