]> icculus.org git repositories - taylor/freespace2.git/blob - include/gropenglinternal.h
rendering functions mostly done; more complete shader setup
[taylor/freespace2.git] / include / gropenglinternal.h
1 /*
2  * Copyright (C) Volition, Inc. 1999.  All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell
5  * or otherwise commercially exploit the source or things you created based on
6  * the source.
7  */
8
9 #ifndef _OPENGLINTERNAL_H
10 #define _OPENGLINTERNAL_H
11
12 #include "2d.h"
13
14
15 typedef enum gr_texture_source {
16         TEXTURE_SOURCE_NONE,
17         TEXTURE_SOURCE_DECAL,
18         TEXTURE_SOURCE_NO_FILTERING,
19 } gr_texture_source;
20
21 typedef enum gr_alpha_blend {
22                 ALPHA_BLEND_NONE,                       // 1*SrcPixel + 0*DestPixel
23                 ALPHA_BLEND_ADDITIVE,                   // 1*SrcPixel + 1*DestPixel
24                 ALPHA_BLEND_ALPHA_ADDITIVE,             // Alpha*SrcPixel + 1*DestPixel
25                 ALPHA_BLEND_ALPHA_BLEND_ALPHA,          // Alpha*SrcPixel + (1-Alpha)*DestPixel
26                 ALPHA_BLEND_ALPHA_BLEND_SRC_COLOR,      // Alpha*SrcPixel + (1-SrcPixel)*DestPixel
27 } gr_alpha_blend;
28
29 typedef enum gr_zbuffer_type {
30                 ZBUFFER_TYPE_NONE,
31                 ZBUFFER_TYPE_READ,
32                 ZBUFFER_TYPE_WRITE,
33                 ZBUFFER_TYPE_FULL,
34 } gr_zbuffer_type;
35
36 extern volatile int GL_activate;
37 extern volatile int GL_deactivate;
38
39 extern SDL_Window *GL_window;
40 extern SDL_GLContext GL_context;
41
42 extern int GL_version;
43
44 extern int GL_viewport_x;
45 extern int GL_viewport_y;
46 extern int GL_viewport_w;
47 extern int GL_viewport_h;
48 extern float GL_viewport_scale_w;
49 extern float GL_viewport_scale_h;
50 extern int GL_min_texture_width;
51 extern int GL_max_texture_width;
52 extern int GL_min_texture_height;
53 extern int GL_max_texture_height;
54
55
56 void opengl_set_variables();
57 void opengl_init_viewport();
58
59 void opengl_stuff_fog_value(float z, float *f_val);
60
61 void opengl_alloc_render_buffer(unsigned int nelems);
62 void opengl_free_render_buffer();
63
64 typedef struct rb_t {
65         float x, y, z, w;
66         float u, v;
67         ubyte r, g, b, a;
68         ubyte sr, sg, sb, sa;
69 } rb_t;
70
71 extern rb_t *render_buffer;
72
73
74 // gr_* pointer functions
75 void gr_opengl_force_fullscreen();
76 void gr_opengl_force_windowed();
77 void gr_opengl_toggle_fullscreen();
78 void gr_opengl_clear();
79 void gr_opengl_reset_clip();
80 void gr_opengl_print_screen(const char *filename);
81 uint gr_opengl_lock();
82 void gr_opengl_unlock();
83 void gr_opengl_zbias(int bias);
84 void gr_opengl_set_cull(int cull);
85 void gr_opengl_activate(int active);
86
87 #endif  // _OPENGLINTERNAL_H