00001 #ifndef BCTEXTURE_H 00002 #define BCTEXTURE_H 00003 00004 00005 #include "vframe.inc" 00006 00007 00008 // Container for texture objects 00009 00010 class BC_Texture 00011 { 00012 public: 00013 BC_Texture(int w, int h, int colormodel); 00014 ~BC_Texture(); 00015 00016 friend class VFrame; 00017 00018 // Create a new texture if *texture if 0 00019 // or update the existing texture if *texture is 00020 // nonzero. The created texture object is stored in *texture. 00021 // The texture parameters are stored in the texture manager. 00022 // The user must delete *texture when finished with it. 00023 // The texture is bound to the current texture unit and enabled. 00024 // Must be called from a synchronous opengl thread after enable_opengl. 00025 static void new_texture(BC_Texture **texture, 00026 int w, 00027 int h, 00028 int colormodel); 00029 00030 // Bind the frame's texture to GL_TEXTURE_2D and enable it. 00031 // If a texture_unit is supplied, the texture unit is made active 00032 // and the commands are run in the right sequence to 00033 // initialize it to our preferred specifications. 00034 // The texture unit initialization requires the texture to be bound. 00035 void bind(int texture_unit = -1); 00036 00037 // Calculate the power of 2 size for allocating textures 00038 static int calculate_texture_size(int w, int *max = 0); 00039 int get_texture_id(); 00040 int get_texture_w(); 00041 int get_texture_h(); 00042 int get_texture_components(); 00043 int get_window_id(); 00044 00045 private: 00046 void clear_objects(); 00047 00048 // creates a new texture or updates an existing texture to work with the 00049 // current window. 00050 void create_texture(int w, int h, int colormodel); 00051 00052 00053 int window_id; 00054 int texture_id; 00055 int texture_w; 00056 int texture_h; 00057 int texture_components; 00058 int colormodel; 00059 int w; 00060 int h; 00061 }; 00062 00063 00064 #endif
1.5.5