r854: Merge 2.1:
[cinelerra_cv/ct.git] / guicast / bctexture.h
blob7b60b2bffde30c4de7ae01c9b5257ea12a6085b8
1 #ifndef BCTEXTURE_H
2 #define BCTEXTURE_H
5 #include "vframe.inc"
8 // Container for texture objects
10 class BC_Texture
12 public:
13 BC_Texture(int w, int h, int colormodel);
14 ~BC_Texture();
16 friend class VFrame;
18 // Create a new texture if *texture if 0
19 // or update the existing texture if *texture is
20 // nonzero. The created texture object is stored in *texture.
21 // The texture parameters are stored in the texture manager.
22 // The user must delete *texture when finished with it.
23 // The texture is bound to the current texture unit and enabled.
24 // Must be called from a synchronous opengl thread after enable_opengl.
25 static void new_texture(BC_Texture **texture,
26 int w,
27 int h,
28 int colormodel);
30 // Bind the frame's texture to GL_TEXTURE_2D and enable it.
31 // If a texture_unit is supplied, the texture unit is made active
32 // and the commands are run in the right sequence to
33 // initialize it to our preferred specifications.
34 // The texture unit initialization requires the texture to be bound.
35 void bind(int texture_unit = -1);
37 // Calculate the power of 2 size for allocating textures
38 static int calculate_texture_size(int w, int *max = 0);
39 int get_texture_id();
40 int get_texture_w();
41 int get_texture_h();
42 int get_texture_components();
43 int get_window_id();
45 private:
46 void clear_objects();
48 // creates a new texture or updates an existing texture to work with the
49 // current window.
50 void create_texture(int w, int h, int colormodel);
53 int window_id;
54 int texture_id;
55 int texture_w;
56 int texture_h;
57 int texture_components;
58 int colormodel;
59 int w;
60 int h;
64 #endif