2#define GF_EXPOSE_TEXTURE
23 glDisable(GL_LIGHTING);
24 glDisable(GL_DEPTH_TEST);
25 glMatrixMode(GL_PROJECTION);
29 glMatrixMode(GL_MODELVIEW);
35 glMatrixMode(GL_MODELVIEW);
37 glMatrixMode(GL_PROJECTION);
39 glMatrixMode(GL_MODELVIEW);
40 glEnable(GL_DEPTH_TEST);
41 glEnable(GL_LIGHTING);
48 double th = (double)texture->height / texture->internal_height;
57 glBegin(GL_TRIANGLE_FAN);
59 for(i = 0; i < npair; i++) {
60 double tx = va_arg(va,
double) * tw;
61 double ty = va_arg(va,
double) * th;
62 double x = va_arg(va,
double);
63 double y = va_arg(va,
double);
68 double z = va_arg(va,
double);
89 glBegin(GL_TRIANGLE_FAN);
91 for(i = 0; i < npair; i++) {
92 double x = va_arg(va,
double);
93 double y = va_arg(va,
double);
97 double z = va_arg(va,
double);
109 double aspect = (double)draw->
width / (
double)draw->
height;
114 for(i = 0; i < 16; i++) matrix[i] = 0;
115 matrix[4 * 0 + 0] = f / aspect;
116 matrix[4 * 1 + 1] = f;
117 matrix[4 * 2 + 2] = (zfar + znear) / (znear - zfar);
118 matrix[4 * 3 + 2] = ((double)2 * zfar * znear) / (znear - zfar);
119 matrix[4 * 2 + 3] = -1;
122 glLoadMatrixd(matrix);
148 for(i = 0; i < 16; i++) matrix[i] = 0;
149 matrix[4 * 0 + 0] = s[0];
150 matrix[4 * 1 + 0] = s[1];
151 matrix[4 * 2 + 0] = s[2];
152 matrix[4 * 0 + 1] = u[0];
153 matrix[4 * 1 + 1] = u[1];
154 matrix[4 * 2 + 1] = u[2];
155 matrix[4 * 0 + 2] = -f[0];
156 matrix[4 * 1 + 2] = -f[1];
157 matrix[4 * 2 + 2] = -f[2];
158 matrix[4 * 3 + 3] = 1;
161 glLoadMatrixd(matrix);
void gf_draw_driver_set_color(gf_draw_t *draw, gf_graphic_color_t color)
Set color.
void gf_draw_driver_end_texture_2d(gf_draw_t *draw)
End 2D texture mode.
void gf_draw_driver_begin_texture_2d(gf_draw_t *draw, gf_texture_t *texture)
Begin 2D texture mode.
#define GF_GRAPHIC_3D
Dimension parameter for 3D.
void gf_graphic_draw_texture_polygon(gf_draw_t *draw, gf_texture_t *texture, gf_graphic_color_t color, int dim, int npair,...)
Draw polygon with texture.
void gf_graphic_clear(gf_draw_t *draw)
Clear the screen.
void gf_graphic_fill_polygon(gf_draw_t *draw, gf_graphic_color_t color, int dim, int npair,...)
Draw polygon.
void gf_graphic_perspective(gf_draw_t *draw, double fovy, double znear, double zfar)
Set perspective.
#define GF_GRAPHIC_2D
Dimension parameter for 2D.
void gf_graphic_end_2d(gf_draw_t *draw)
End 2D mode.
void gf_graphic_begin_2d(gf_draw_t *draw)
Start 2D mode.
void gf_graphic_set_camera(gf_draw_t *draw)
Set camera.
#define GF_EXPORT
Macro for platform-dependent symbol export/import.
void gf_math_multiply(gf_math_vector_t r, gf_math_vector_t v0, gf_math_vector_t v1)
Multiply vector by vector.
void gf_math_normalize(gf_math_vector_t v)
Normalize vector.
double gf_math_cot(double x)
Calculate cot(x)
Required headers before anything.
double gf_math_vector_t[4]
Vector.
gf_math_vector_t lookat
Where to look at.
gf_math_vector_t camera
Camera location.
int width
Width of window.
int height
Height of window.
int internal_width
Internal width of texture.
int width
Width of texture.