00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00023 #ifndef INCLUDE_3D_TEXTURE_H
00024 #define INCLUDE_3D_TEXTURE_H
00025
00026 #include "3d.h"
00027 #include "color.h"
00028
00029 typedef enum
00030 {
00031 texture1D = GL_TEXTURE_1D ,
00032 texture2D = GL_TEXTURE_2D,
00033 texture3D = GL_TEXTURE_3D
00034 } TextureTarget;
00035
00036 typedef enum
00037 {
00038 clamp = GL_CLAMP,
00039 repeat = GL_REPEAT
00040 } TextureWrap;
00041
00042 typedef enum
00043 {
00044 nearest = GL_NEAREST,
00045 linear = GL_LINEAR
00046 } TextureFilter;
00047
00048 typedef enum
00049 {
00050 modulate = GL_MODULATE,
00051 decal = GL_DECAL,
00052 blend = GL_BLEND,
00053 replace = GL_REPLACE,
00054 } TextureEnvMode;
00055
00063 class Texture
00064 {
00065 public:
00066 static MyList<Texture *> list;
00067 GLint id;
00068 MyString name;
00069 MyString source;
00070 BOOL useResizing;
00071 GLdouble xScale,yScale;
00072 int xSize,ySize;
00073 TextureTarget target;
00074 TextureWrap wrapT,wrapS;
00075 TextureFilter magFilter,minFilter;
00076 TextureEnvMode envMode;
00077 Color envColor;
00078 Color border;
00079
00080 public:
00081 static Texture * Find(char *name);
00082 static BOOL Delete(Texture *texture);
00083
00084 public:
00085 void VerifyId();
00086 void Config();
00087 void ConfigPixelStore();
00088 GLubyte * ConfigSize (int _xSize,int _ySize,BOOL allocate,BOOL resizeIt);
00089 void SetCoord(double x,double y);
00090 BOOL Delete();
00091
00092 public:
00093 Texture();
00094 ~Texture();
00095 void Zero();
00096 void operator =(Texture &src);
00097 BOOL CreateNull();
00098 BOOL CreateFromBitmap(char *_name,char *fileName,BOOL resizeIt=FALSE);
00099 BOOL CreateFromText(char *_name,char *text,COLORREF color,COLORREF background,COLORREF background2,COLORREF contour,int xFormat=0,int yFormat=0);
00100 operator GLuint () const { return id; }
00101 };
00102
00103 #endif