2
* pdp system module - texture packet type
3
* Copyright (c) by Tom Schouten <pdp@zzz.kotnet.org>
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27
//#include <GL/glut.h>
38
u32 tex_obj; /* gl texture object */
39
s32 format; /* texture format */
43
u32 sub_width; /* portion of texture used */
48
#define PDP_TEXTURE 4 /* opengl texture object */
51
/* all symbols are C-style */
58
/* check if valid texture packet. all other methods assume packet is valid */
59
bool pdp_packet_texture_isvalid(int packet);
61
/* returns a pointer to the packet subheader whem the packet contains a texture */
62
/* try not to use the header directly, use clone and copy methods instead */
63
t_texture *pdp_packet_texture_info(int packet);
65
/* texture constructors */
66
int pdp_packet_new_texture(u32 width, u32 height, s32 format); /* create a texture packet */
69
/* texture operators */
70
void pdp_packet_texture_make_current(int packet); /* make a texture the current texture context */
71
u32 pdp_packet_texture_total_width(int packet); /* width of texture */
72
u32 pdp_packet_texture_total_height(int packet); /* get heigth of texture */
73
u32 pdp_packet_texture_sub_width(int packet); /* width of subtexture */
74
u32 pdp_packet_texture_sub_height(int packet); /* heigth of subtexture */
75
float pdp_packet_texture_fracx(int packet); /* x fraction */
76
float pdp_packet_texture_fracy(int packet); /* y fraction */
77
float pdp_packet_texture_sub_aspect(int packet);
79
/* some utility methods */
80
void pdp_packet_texture_make_current_enable(int packet); /* make current & enable with default texture settings (for the lazy)*/
81
void pdp_packet_texture_setup_2d_context(int packet); /* set up 2d context (viewport, projection, modelview) from texture dims */
93
#endif //PDP_TEXTURE_H