4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 // Container for texture objects
34 BC_Texture(int w, int h, int colormodel);
39 // Create a new texture if *texture if 0
40 // or update the existing texture if *texture is
41 // nonzero. The created texture object is stored in *texture.
42 // The texture parameters are stored in the texture manager.
43 // The user must delete *texture when finished with it.
44 // The texture is bound to the current texture unit and enabled.
45 // Must be called from a synchronous opengl thread after enable_opengl.
46 static void new_texture(BC_Texture **texture,
51 // Bind the frame's texture to GL_TEXTURE_2D and enable it.
52 // If a texture_unit is supplied, the texture unit is made active
53 // and the commands are run in the right sequence to
54 // initialize it to our preferred specifications.
55 // The texture unit initialization requires the texture to be bound.
56 void bind(int texture_unit, int nearest=0);
58 // Calculate the power of 2 size for allocating textures
59 static int calculate_texture_size(int w, int *max = 0);
63 int get_texture_components();
66 float in_x1, float in_y1, float in_x2, float in_y2,
67 float out_x1, float out_y1, float out_x2, float out_y2);
69 void write_tex(const char *fn, int id);
70 void write_tex(const char *fn);
74 // creates a new texture or updates an existing texture to work with the
76 void create_texture(int w, int h, int colormodel);
83 int texture_components;