FS2_Open
Open source remastering of the Freespace 2 engine
gropengldraw.h
Go to the documentation of this file.
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 the
6  * source.
7  *
8 */
9 
10 
11 #ifndef GR_OPENGLDRAW_H
12 #define GR_OPENGLDRAW_H
13 
14 #include "graphics/2d.h"
15 #include "graphics/gropenglstate.h"
16 #include "graphics/shadows.h"
17 
18 void gr_opengl_aabitmap_ex(int x, int y, int w, int h, int sx, int sy, int resize_mode, bool mirror);
19 void gr_opengl_aabitmap(int x, int y, int resize_mode, bool mirror);
20 void gr_opengl_string(int sx, int sy, const char *s, int resize_mode = GR_RESIZE_FULL);
21 void gr_opengl_line(int x1,int y1,int x2,int y2, int resize_mode);
23 void gr_opengl_pixel(int x, int y, int resize_mode);
24 void gr_opengl_gradient(int x1, int y1, int x2, int y2, int resize_mode);
25 void gr_opengl_circle(int xc, int yc, int d, int resize_mode);
26 void gr_opengl_unfilled_circle(int xc, int yc, int d, int resize_mode);
27 void gr_opengl_arc(int xc, int yc, float r, float angle_start, float angle_end, bool fill, int resize_mode);
28 void gr_opengl_curve(int xc, int yc, int r, int direction, int resize_mode);
29 void gr_opengl_scaler(vertex *va, vertex *vb, bool bw_bitmap );
30 void gr_opengl_cross_fade(int bmap1, int bmap2, int x1, int y1, int x2, int y2, float pct, int resize_mode);
31 void gr_opengl_shade(int x, int y, int w, int h, int resize_mode);
32 void gr_opengl_flash(int r, int g, int b);
33 void gr_opengl_flash_alpha(int r, int g, int b, int a);
34 void gr_opengl_tmapper(int nverts, vertex **verts, uint flags);
35 void gr_opengl_render(int nverts, vertex *verts, uint flags);
36 void gr_opengl_render_effect(int nverts, vertex *verts, float *radius_list, uint flags);
37 void gr_opengl_bitmap_ex(int x, int y, int w, int h, int sx, int sy, int resize_mode);
39 
40 void opengl_set_spec_mapping(int tmap_type, float *u_scale, float *v_scale, int stage = 0);
42 
43 void gr_opengl_line_htl(const vec3d *start, const vec3d *end);
44 void gr_opengl_sphere_htl(float rad);
45 void gr_opengl_deferred_light_sphere_init(int rings, int segments);
46 void gr_opengl_draw_deferred_light_sphere(const vec3d *position, float rad, bool clearStencil);
48 void gr_opengl_draw_deferred_light_cylinder(const vec3d *position, const matrix *orient, float rad, float length, bool clearStencil);
49 
50 void gr_opengl_draw_line_list(const colored_vector *lines, int num);
51 
52 void gr_opengl_shadow_map_start(const matrix4 *shadow_view_matrix, const matrix *light_orient);
54 
60 
65 
67 
70  GLfloat x2, GLfloat y2, GLfloat u2, GLfloat v2,
71  int count )
72 {
73  GLfloat glVertices[4][4] = {
74  { x1, y1, u1, v1 },
75  { x1, y2, u1, v2 },
76  { x2, y1, u2, v1 },
77  { x2, y2, u2, v2 }
78  };
79 
81 
82  vertex_layout vert_def;
83 
84  vert_def.add_vertex_component(vertex_format_data::POSITION2, sizeof(glVertices[0]), glVertices);
85  vert_def.add_vertex_component(vertex_format_data::TEX_COORD, sizeof(glVertices[0]), &(glVertices[0][2]));
86 
87  opengl_bind_vertex_layout(vert_def);
88 
89  //glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
91 }
92 
95  GLfloat x2, GLfloat y2, GLfloat u2, GLfloat v2 )
96 {
97  GLfloat glVertices[4][4] = {
98  { x1, y1, u1, v1 },
99  { x1, y2, u1, v2 },
100  { x2, y1, u2, v1 },
101  { x2, y2, u2, v2 }
102  };
103 
105 
106  vertex_layout vert_def;
107 
108  vert_def.add_vertex_component(vertex_format_data::POSITION2, sizeof(glVertices[0]), glVertices);
109  vert_def.add_vertex_component(vertex_format_data::TEX_COORD, sizeof(glVertices[0]), &(glVertices[0][2]));
110 
111  opengl_bind_vertex_layout(vert_def);
112 
114 }
115 
117  GLint x1, GLint y1,
118  GLint x2, GLint y2 )
119 {
120  GLint glVertices[8] = {
121  x1, y1,
122  x1, y2,
123  x2, y1,
124  x2, y2
125  };
126 
127  vertex_layout vert_def;
128 
129  vert_def.add_vertex_component(vertex_format_data::SCREEN_POS, 0, glVertices);
130 
131  opengl_bind_vertex_layout(vert_def);
132 
134 }
135 
137  GLfloat x1, GLfloat y1,
138  GLfloat x2, GLfloat y2 )
139 {
140  GLfloat glVertices[8] = {
141  x1, y1,
142  x1, y2,
143  x2, y1,
144  x2, y2
145  };
146 
147  vertex_layout vert_def;
148 
149  vert_def.add_vertex_component(vertex_format_data::POSITION2, 0, glVertices);
150 
151  opengl_bind_vertex_layout(vert_def);
152 
154 }
155 
156 extern int Scene_texture_initialized;
157 
161 
162 extern int Scene_texture_width;
163 extern int Scene_texture_height;
164 
165 extern float Scene_texture_u_scale;
166 extern float Scene_texture_v_scale;
167 
168 extern bool Deferred_lighting;
169 
171 
172 #endif // !GR_OPENGLDRAW_H
GLuint Scene_color_texture
unsigned int GLuint
Definition: Gl.h:52
void opengl_scene_texture_shutdown()
void gr_opengl_deferred_lighting_begin()
void opengl_set_spec_mapping(int tmap_type, float *u_scale, float *v_scale, int stage=0)
void gr_opengl_shadow_map_end()
bool Use_Shaders_for_effect_rendering
void gr_opengl_render(int nverts, vertex *verts, uint flags)
void gr_opengl_gradient(int x1, int y1, int x2, int y2, int resize_mode)
WINGDIAPI void APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count)
void gr_opengl_flash_alpha(int r, int g, int b, int a)
GLfloat GLfloat GLfloat GLfloat h
Definition: Glext.h:7280
void gr_opengl_sphere_htl(float rad)
void gr_opengl_bitmap_ex(int x, int y, int w, int h, int sx, int sy, int resize_mode)
void gr_opengl_draw_deferred_light_sphere(const vec3d *position, float rad, bool clearStencil)
int Scene_texture_initialized
opengl_array_state Array
void gr_opengl_aabitmap(int x, int y, int resize_mode, bool mirror)
void gr_opengl_copy_effect_texture()
float Scene_texture_u_scale
Definition: pstypes.h:88
void opengl_draw_textured_quad(GLfloat x1, GLfloat y1, GLfloat u1, GLfloat v1, GLfloat x2, GLfloat y2, GLfloat u2, GLfloat v2)
Definition: gropengldraw.h:93
void gr_opengl_deferred_lighting_finish()
void gr_opengl_circle(int xc, int yc, int d, int resize_mode)
bool Deferred_lighting
void opengl_draw_textured_quad_instanced(GLfloat x1, GLfloat y1, GLfloat u1, GLfloat v1, GLfloat x2, GLfloat y2, GLfloat u2, GLfloat v2, int count)
Definition: gropengldraw.h:68
void gr_opengl_line(int x1, int y1, int x2, int y2, int resize_mode)
hull_check orient
Definition: lua.cpp:5049
#define vglDrawArraysInstancedARB
void gr_opengl_shade(int x, int y, int w, int h, int resize_mode)
GLfloat GLfloat GLfloat v2
Definition: Glext.h:5640
void gr_opengl_draw_deferred_light_cylinder(const vec3d *position, const matrix *orient, float rad, float length, bool clearStencil)
GLdouble u1
Definition: Glext.h:7779
void opengl_draw_coloured_quad(GLint x1, GLint y1, GLint x2, GLint y2)
Definition: gropengldraw.h:116
GLdouble GLdouble GLdouble r
Definition: Glext.h:5337
unsigned int uint
Definition: pstypes.h:64
int Scene_texture_width
GLboolean GLboolean g
Definition: Glext.h:5781
void add_vertex_component(vertex_format_data::vertex_format format_type, uint stride, void *src)
Definition: 2d.h:1054
void gr_opengl_render_effect(int nverts, vertex *verts, float *radius_list, uint flags)
GLboolean GLboolean GLboolean GLboolean a
Definition: Glext.h:5781
GLdouble s
Definition: Glext.h:5321
void gr_opengl_arc(int xc, int yc, float r, float angle_start, float angle_end, bool fill, int resize_mode)
void gr_opengl_string(int sx, int sy, const char *s, int resize_mode=GR_RESIZE_FULL)
GLuint Scene_effect_texture
void gr_opengl_deferred_light_cylinder_init(int segments)
GLint GLint GLint GLint GLint x
Definition: Glext.h:5182
GLuint Scene_luminance_texture
void gr_opengl_deferred_light_sphere_init(int rings, int segments)
void gr_opengl_cross_fade(int bmap1, int bmap2, int x1, int y1, int x2, int y2, float pct, int resize_mode)
GLuint start
Definition: Gl.h:1502
GLfloat GLfloat v1
Definition: Glext.h:5639
#define GR_RESIZE_FULL
Definition: 2d.h:682
void gr_opengl_flash(int r, int g, int b)
GLbitfield flags
Definition: Glext.h:6722
void BindArrayBuffer(GLuint id)
void gr_opengl_scene_texture_end()
GLboolean GLboolean GLboolean b
Definition: Glext.h:5781
void gr_opengl_scaler(vertex *va, vertex *vb, bool bw_bitmap)
GLuint GLuint num
Definition: Glext.h:9089
opengl_state GL_state
GLubyte GLubyte GLubyte GLubyte w
Definition: Glext.h:5679
void gr_opengl_tmapper(int nverts, vertex **verts, uint flags)
void opengl_bind_vertex_layout(vertex_layout &layout)
void gr_opengl_shadow_map_start(const matrix4 *shadow_view_matrix, const matrix *light_orient)
void gr_opengl_scene_texture_begin()
void gr_opengl_pixel(int x, int y, int resize_mode)
GLenum GLuint GLenum GLsizei length
Definition: Glext.h:5156
GLint GLsizei count
Definition: Gl.h:1491
void opengl_clear_deferred_buffers()
float Scene_texture_v_scale
void gr_opengl_draw_line_list(const colored_vector *lines, int num)
void gr_opengl_line_htl(const vec3d *start, const vec3d *end)
void gr_opengl_update_distortion()
void gr_opengl_aabitmap_ex(int x, int y, int w, int h, int sx, int sy, int resize_mode, bool mirror)
void opengl_setup_scene_textures()
void gr_opengl_deferred_lighting_end()
void gr_opengl_aaline(vertex *v1, vertex *v2)
GLdouble GLdouble u2
Definition: Glext.h:7779
void opengl_reset_spec_mapping()
void gr_opengl_unfilled_circle(int xc, int yc, int d, int resize_mode)
int Scene_texture_height
GLuint GLuint end
Definition: Gl.h:1502
GLint y
Definition: Gl.h:1505
void gr_opengl_curve(int xc, int yc, int r, int direction, int resize_mode)
int GLint
Definition: Gl.h:48
float GLfloat
Definition: Gl.h:53
#define GL_TRIANGLE_STRIP
Definition: Gl.h:110