gfx: more cull face coverage
parent
2277b42619
commit
d05c92a9b7
|
@ -364141,6 +364141,15 @@ API void gui_drawrect( texture_t spritesheet, vec2 tex_start, vec2 tex_end, int
|
|||
#define v42v2(rect) vec2(rect.x,rect.y), vec2(rect.z,rect.w)
|
||||
|
||||
void gui_drawrect( texture_t texture, vec2 tex_start, vec2 tex_end, int rgba, vec2 start, vec2 end ) {
|
||||
static renderstate_t rect_rs;
|
||||
do_once {
|
||||
rect_rs = renderstate();
|
||||
rect_rs.depth_test_enabled = false;
|
||||
rect_rs.blend_enabled = true;
|
||||
rect_rs.blend_src = GL_SRC_ALPHA;
|
||||
rect_rs.blend_dst = GL_ONE_MINUS_SRC_ALPHA;
|
||||
rect_rs.front_face = GL_CW;
|
||||
}
|
||||
static int program = -1, vbo = -1, vao = -1, u_tint = -1, u_has_tex = -1, u_window_width = -1, u_window_height = -1;
|
||||
float gamma = 1;
|
||||
vec2 dpi = ifdef(osx, window_dpi(), vec2(1,1));
|
||||
|
@ -364162,9 +364171,7 @@ void gui_drawrect( texture_t texture, vec2 tex_start, vec2 tex_end, int rgba, ve
|
|||
start = mul2(start, dpi);
|
||||
end = mul2(end, dpi);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
renderstate_apply(&rect_rs);
|
||||
|
||||
GLenum texture_type = texture.flags & TEXTURE_ARRAY ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;
|
||||
glUseProgram( program );
|
||||
|
@ -370141,7 +370148,7 @@ renderstate_t renderstate() {
|
|||
state.blend_dst = GL_ZERO;
|
||||
|
||||
// Disable culling by default but cull back faces
|
||||
state.cull_face_enabled = GL_FALSE;
|
||||
state.cull_face_enabled = GL_TRUE;
|
||||
state.cull_face_mode = GL_BACK;
|
||||
|
||||
// Disable stencil test by default
|
||||
|
@ -371539,7 +371546,22 @@ void shadowmatrix_ortho(mat44 shm_proj, float left, float right, float bottom, f
|
|||
// usage: bind empty vao & commit call for 6 (quad) or 3 vertices (tri).
|
||||
// ie, glBindVertexArray(empty_vao); glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
|
||||
static renderstate_t fullscreen_quad_rs;
|
||||
|
||||
static inline
|
||||
void fullscreen_quad_rs_init() {
|
||||
do_once {
|
||||
fullscreen_quad_rs = renderstate();
|
||||
fullscreen_quad_rs.depth_test_enabled = false;
|
||||
fullscreen_quad_rs.blend_enabled = true;
|
||||
fullscreen_quad_rs.blend_src = GL_SRC_ALPHA;
|
||||
fullscreen_quad_rs.blend_dst = GL_ONE_MINUS_SRC_ALPHA;
|
||||
fullscreen_quad_rs.front_face = GL_CCW;
|
||||
}
|
||||
}
|
||||
|
||||
void fullscreen_quad_rgb( texture_t texture ) {
|
||||
fullscreen_quad_rs_init();
|
||||
static int program = -1, vao = -1, u_inv_gamma = -1;
|
||||
if( program < 0 ) {
|
||||
const char* vs = vfs_read("shaders/vs_0_2_fullscreen_quad_B_flipped.glsl");
|
||||
|
@ -371551,7 +371573,7 @@ void fullscreen_quad_rgb( texture_t texture ) {
|
|||
}
|
||||
|
||||
GLenum texture_type = texture.flags & TEXTURE_ARRAY ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;
|
||||
// glEnable( GL_BLEND );
|
||||
renderstate_apply(&fullscreen_quad_rs);
|
||||
glUseProgram( program );
|
||||
float gamma = 1;
|
||||
glUniform1f( u_inv_gamma, gamma );
|
||||
|
@ -371572,6 +371594,7 @@ void fullscreen_quad_rgb( texture_t texture ) {
|
|||
}
|
||||
|
||||
void fullscreen_quad_rgb_flipped( texture_t texture ) {
|
||||
fullscreen_quad_rs_init();
|
||||
static int program = -1, vao = -1, u_inv_gamma = -1;
|
||||
if( program < 0 ) {
|
||||
const char* vs = vfs_read("shaders/vs_0_2_fullscreen_quad_B.glsl");
|
||||
|
@ -371583,7 +371606,7 @@ void fullscreen_quad_rgb_flipped( texture_t texture ) {
|
|||
}
|
||||
|
||||
GLenum texture_type = texture.flags & TEXTURE_ARRAY ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;
|
||||
// glEnable( GL_BLEND );
|
||||
renderstate_apply(&fullscreen_quad_rs);
|
||||
glUseProgram( program );
|
||||
float gamma = 1;
|
||||
glUniform1f( u_inv_gamma, gamma );
|
||||
|
@ -371604,6 +371627,7 @@ void fullscreen_quad_rgb_flipped( texture_t texture ) {
|
|||
}
|
||||
|
||||
void fullscreen_quad_ycbcr( texture_t textureYCbCr[3] ) {
|
||||
fullscreen_quad_rs_init();
|
||||
static int program = -1, vao = -1, u_gamma = -1, uy = -1, ucb = -1, ucr = -1;
|
||||
if( program < 0 ) {
|
||||
const char* vs = vfs_read("shaders/vs_0_2_fullscreen_quad_B_flipped.glsl");
|
||||
|
@ -371619,7 +371643,7 @@ void fullscreen_quad_ycbcr( texture_t textureYCbCr[3] ) {
|
|||
glGenVertexArrays( 1, (GLuint*)&vao );
|
||||
}
|
||||
|
||||
// glEnable( GL_BLEND );
|
||||
renderstate_apply(&fullscreen_quad_rs);
|
||||
glUseProgram( program );
|
||||
// glUniform1f( u_gamma, gamma );
|
||||
|
||||
|
@ -371648,6 +371672,7 @@ void fullscreen_quad_ycbcr( texture_t textureYCbCr[3] ) {
|
|||
}
|
||||
|
||||
void fullscreen_quad_ycbcr_flipped( texture_t textureYCbCr[3] ) {
|
||||
fullscreen_quad_rs_init();
|
||||
static int program = -1, vao = -1, u_gamma = -1, uy = -1, ucb = -1, ucr = -1;
|
||||
if( program < 0 ) {
|
||||
const char* vs = vfs_read("shaders/vs_0_2_fullscreen_quad_B.glsl");
|
||||
|
@ -371663,7 +371688,7 @@ void fullscreen_quad_ycbcr_flipped( texture_t textureYCbCr[3] ) {
|
|||
glGenVertexArrays( 1, (GLuint*)&vao );
|
||||
}
|
||||
|
||||
// glEnable( GL_BLEND );
|
||||
renderstate_apply(&fullscreen_quad_rs);
|
||||
glUseProgram( program );
|
||||
// glUniform1f( u_gamma, gamma );
|
||||
|
||||
|
|
|
@ -6,6 +6,15 @@ API void gui_drawrect( texture_t spritesheet, vec2 tex_start, vec2 tex_end, int
|
|||
#define v42v2(rect) vec2(rect.x,rect.y), vec2(rect.z,rect.w)
|
||||
|
||||
void gui_drawrect( texture_t texture, vec2 tex_start, vec2 tex_end, int rgba, vec2 start, vec2 end ) {
|
||||
static renderstate_t rect_rs;
|
||||
do_once {
|
||||
rect_rs = renderstate();
|
||||
rect_rs.depth_test_enabled = false;
|
||||
rect_rs.blend_enabled = true;
|
||||
rect_rs.blend_src = GL_SRC_ALPHA;
|
||||
rect_rs.blend_dst = GL_ONE_MINUS_SRC_ALPHA;
|
||||
rect_rs.front_face = GL_CW;
|
||||
}
|
||||
static int program = -1, vbo = -1, vao = -1, u_tint = -1, u_has_tex = -1, u_window_width = -1, u_window_height = -1;
|
||||
float gamma = 1;
|
||||
vec2 dpi = ifdef(osx, window_dpi(), vec2(1,1));
|
||||
|
@ -27,9 +36,7 @@ void gui_drawrect( texture_t texture, vec2 tex_start, vec2 tex_end, int rgba, ve
|
|||
start = mul2(start, dpi);
|
||||
end = mul2(end, dpi);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
renderstate_apply(&rect_rs);
|
||||
|
||||
GLenum texture_type = texture.flags & TEXTURE_ARRAY ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;
|
||||
glUseProgram( program );
|
||||
|
|
|
@ -76,7 +76,7 @@ renderstate_t renderstate() {
|
|||
state.blend_dst = GL_ZERO;
|
||||
|
||||
// Disable culling by default but cull back faces
|
||||
state.cull_face_enabled = GL_FALSE;
|
||||
state.cull_face_enabled = GL_TRUE;
|
||||
state.cull_face_mode = GL_BACK;
|
||||
|
||||
// Disable stencil test by default
|
||||
|
@ -1474,7 +1474,22 @@ void shadowmatrix_ortho(mat44 shm_proj, float left, float right, float bottom, f
|
|||
// usage: bind empty vao & commit call for 6 (quad) or 3 vertices (tri).
|
||||
// ie, glBindVertexArray(empty_vao); glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
|
||||
static renderstate_t fullscreen_quad_rs;
|
||||
|
||||
static inline
|
||||
void fullscreen_quad_rs_init() {
|
||||
do_once {
|
||||
fullscreen_quad_rs = renderstate();
|
||||
fullscreen_quad_rs.depth_test_enabled = false;
|
||||
fullscreen_quad_rs.blend_enabled = true;
|
||||
fullscreen_quad_rs.blend_src = GL_SRC_ALPHA;
|
||||
fullscreen_quad_rs.blend_dst = GL_ONE_MINUS_SRC_ALPHA;
|
||||
fullscreen_quad_rs.front_face = GL_CCW;
|
||||
}
|
||||
}
|
||||
|
||||
void fullscreen_quad_rgb( texture_t texture ) {
|
||||
fullscreen_quad_rs_init();
|
||||
static int program = -1, vao = -1, u_inv_gamma = -1;
|
||||
if( program < 0 ) {
|
||||
const char* vs = vfs_read("shaders/vs_0_2_fullscreen_quad_B_flipped.glsl");
|
||||
|
@ -1486,7 +1501,7 @@ void fullscreen_quad_rgb( texture_t texture ) {
|
|||
}
|
||||
|
||||
GLenum texture_type = texture.flags & TEXTURE_ARRAY ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;
|
||||
// glEnable( GL_BLEND );
|
||||
renderstate_apply(&fullscreen_quad_rs);
|
||||
glUseProgram( program );
|
||||
float gamma = 1;
|
||||
glUniform1f( u_inv_gamma, gamma );
|
||||
|
@ -1507,6 +1522,7 @@ void fullscreen_quad_rgb( texture_t texture ) {
|
|||
}
|
||||
|
||||
void fullscreen_quad_rgb_flipped( texture_t texture ) {
|
||||
fullscreen_quad_rs_init();
|
||||
static int program = -1, vao = -1, u_inv_gamma = -1;
|
||||
if( program < 0 ) {
|
||||
const char* vs = vfs_read("shaders/vs_0_2_fullscreen_quad_B.glsl");
|
||||
|
@ -1518,7 +1534,7 @@ void fullscreen_quad_rgb_flipped( texture_t texture ) {
|
|||
}
|
||||
|
||||
GLenum texture_type = texture.flags & TEXTURE_ARRAY ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;
|
||||
// glEnable( GL_BLEND );
|
||||
renderstate_apply(&fullscreen_quad_rs);
|
||||
glUseProgram( program );
|
||||
float gamma = 1;
|
||||
glUniform1f( u_inv_gamma, gamma );
|
||||
|
@ -1539,6 +1555,7 @@ void fullscreen_quad_rgb_flipped( texture_t texture ) {
|
|||
}
|
||||
|
||||
void fullscreen_quad_ycbcr( texture_t textureYCbCr[3] ) {
|
||||
fullscreen_quad_rs_init();
|
||||
static int program = -1, vao = -1, u_gamma = -1, uy = -1, ucb = -1, ucr = -1;
|
||||
if( program < 0 ) {
|
||||
const char* vs = vfs_read("shaders/vs_0_2_fullscreen_quad_B_flipped.glsl");
|
||||
|
@ -1554,7 +1571,7 @@ void fullscreen_quad_ycbcr( texture_t textureYCbCr[3] ) {
|
|||
glGenVertexArrays( 1, (GLuint*)&vao );
|
||||
}
|
||||
|
||||
// glEnable( GL_BLEND );
|
||||
renderstate_apply(&fullscreen_quad_rs);
|
||||
glUseProgram( program );
|
||||
// glUniform1f( u_gamma, gamma );
|
||||
|
||||
|
@ -1583,6 +1600,7 @@ void fullscreen_quad_ycbcr( texture_t textureYCbCr[3] ) {
|
|||
}
|
||||
|
||||
void fullscreen_quad_ycbcr_flipped( texture_t textureYCbCr[3] ) {
|
||||
fullscreen_quad_rs_init();
|
||||
static int program = -1, vao = -1, u_gamma = -1, uy = -1, ucb = -1, ucr = -1;
|
||||
if( program < 0 ) {
|
||||
const char* vs = vfs_read("shaders/vs_0_2_fullscreen_quad_B.glsl");
|
||||
|
@ -1598,7 +1616,7 @@ void fullscreen_quad_ycbcr_flipped( texture_t textureYCbCr[3] ) {
|
|||
glGenVertexArrays( 1, (GLuint*)&vao );
|
||||
}
|
||||
|
||||
// glEnable( GL_BLEND );
|
||||
renderstate_apply(&fullscreen_quad_rs);
|
||||
glUseProgram( program );
|
||||
// glUniform1f( u_gamma, gamma );
|
||||
|
||||
|
|
41
engine/v4k.c
41
engine/v4k.c
|
@ -11240,6 +11240,15 @@ API void gui_drawrect( texture_t spritesheet, vec2 tex_start, vec2 tex_end, int
|
|||
#define v42v2(rect) vec2(rect.x,rect.y), vec2(rect.z,rect.w)
|
||||
|
||||
void gui_drawrect( texture_t texture, vec2 tex_start, vec2 tex_end, int rgba, vec2 start, vec2 end ) {
|
||||
static renderstate_t rect_rs;
|
||||
do_once {
|
||||
rect_rs = renderstate();
|
||||
rect_rs.depth_test_enabled = false;
|
||||
rect_rs.blend_enabled = true;
|
||||
rect_rs.blend_src = GL_SRC_ALPHA;
|
||||
rect_rs.blend_dst = GL_ONE_MINUS_SRC_ALPHA;
|
||||
rect_rs.front_face = GL_CW;
|
||||
}
|
||||
static int program = -1, vbo = -1, vao = -1, u_tint = -1, u_has_tex = -1, u_window_width = -1, u_window_height = -1;
|
||||
float gamma = 1;
|
||||
vec2 dpi = ifdef(osx, window_dpi(), vec2(1,1));
|
||||
|
@ -11261,9 +11270,7 @@ void gui_drawrect( texture_t texture, vec2 tex_start, vec2 tex_end, int rgba, ve
|
|||
start = mul2(start, dpi);
|
||||
end = mul2(end, dpi);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
renderstate_apply(&rect_rs);
|
||||
|
||||
GLenum texture_type = texture.flags & TEXTURE_ARRAY ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;
|
||||
glUseProgram( program );
|
||||
|
@ -17240,7 +17247,7 @@ renderstate_t renderstate() {
|
|||
state.blend_dst = GL_ZERO;
|
||||
|
||||
// Disable culling by default but cull back faces
|
||||
state.cull_face_enabled = GL_FALSE;
|
||||
state.cull_face_enabled = GL_TRUE;
|
||||
state.cull_face_mode = GL_BACK;
|
||||
|
||||
// Disable stencil test by default
|
||||
|
@ -18638,7 +18645,22 @@ void shadowmatrix_ortho(mat44 shm_proj, float left, float right, float bottom, f
|
|||
// usage: bind empty vao & commit call for 6 (quad) or 3 vertices (tri).
|
||||
// ie, glBindVertexArray(empty_vao); glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
|
||||
static renderstate_t fullscreen_quad_rs;
|
||||
|
||||
static inline
|
||||
void fullscreen_quad_rs_init() {
|
||||
do_once {
|
||||
fullscreen_quad_rs = renderstate();
|
||||
fullscreen_quad_rs.depth_test_enabled = false;
|
||||
fullscreen_quad_rs.blend_enabled = true;
|
||||
fullscreen_quad_rs.blend_src = GL_SRC_ALPHA;
|
||||
fullscreen_quad_rs.blend_dst = GL_ONE_MINUS_SRC_ALPHA;
|
||||
fullscreen_quad_rs.front_face = GL_CCW;
|
||||
}
|
||||
}
|
||||
|
||||
void fullscreen_quad_rgb( texture_t texture ) {
|
||||
fullscreen_quad_rs_init();
|
||||
static int program = -1, vao = -1, u_inv_gamma = -1;
|
||||
if( program < 0 ) {
|
||||
const char* vs = vfs_read("shaders/vs_0_2_fullscreen_quad_B_flipped.glsl");
|
||||
|
@ -18650,7 +18672,7 @@ void fullscreen_quad_rgb( texture_t texture ) {
|
|||
}
|
||||
|
||||
GLenum texture_type = texture.flags & TEXTURE_ARRAY ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;
|
||||
// glEnable( GL_BLEND );
|
||||
renderstate_apply(&fullscreen_quad_rs);
|
||||
glUseProgram( program );
|
||||
float gamma = 1;
|
||||
glUniform1f( u_inv_gamma, gamma );
|
||||
|
@ -18671,6 +18693,7 @@ void fullscreen_quad_rgb( texture_t texture ) {
|
|||
}
|
||||
|
||||
void fullscreen_quad_rgb_flipped( texture_t texture ) {
|
||||
fullscreen_quad_rs_init();
|
||||
static int program = -1, vao = -1, u_inv_gamma = -1;
|
||||
if( program < 0 ) {
|
||||
const char* vs = vfs_read("shaders/vs_0_2_fullscreen_quad_B.glsl");
|
||||
|
@ -18682,7 +18705,7 @@ void fullscreen_quad_rgb_flipped( texture_t texture ) {
|
|||
}
|
||||
|
||||
GLenum texture_type = texture.flags & TEXTURE_ARRAY ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D;
|
||||
// glEnable( GL_BLEND );
|
||||
renderstate_apply(&fullscreen_quad_rs);
|
||||
glUseProgram( program );
|
||||
float gamma = 1;
|
||||
glUniform1f( u_inv_gamma, gamma );
|
||||
|
@ -18703,6 +18726,7 @@ void fullscreen_quad_rgb_flipped( texture_t texture ) {
|
|||
}
|
||||
|
||||
void fullscreen_quad_ycbcr( texture_t textureYCbCr[3] ) {
|
||||
fullscreen_quad_rs_init();
|
||||
static int program = -1, vao = -1, u_gamma = -1, uy = -1, ucb = -1, ucr = -1;
|
||||
if( program < 0 ) {
|
||||
const char* vs = vfs_read("shaders/vs_0_2_fullscreen_quad_B_flipped.glsl");
|
||||
|
@ -18718,7 +18742,7 @@ void fullscreen_quad_ycbcr( texture_t textureYCbCr[3] ) {
|
|||
glGenVertexArrays( 1, (GLuint*)&vao );
|
||||
}
|
||||
|
||||
// glEnable( GL_BLEND );
|
||||
renderstate_apply(&fullscreen_quad_rs);
|
||||
glUseProgram( program );
|
||||
// glUniform1f( u_gamma, gamma );
|
||||
|
||||
|
@ -18747,6 +18771,7 @@ void fullscreen_quad_ycbcr( texture_t textureYCbCr[3] ) {
|
|||
}
|
||||
|
||||
void fullscreen_quad_ycbcr_flipped( texture_t textureYCbCr[3] ) {
|
||||
fullscreen_quad_rs_init();
|
||||
static int program = -1, vao = -1, u_gamma = -1, uy = -1, ucb = -1, ucr = -1;
|
||||
if( program < 0 ) {
|
||||
const char* vs = vfs_read("shaders/vs_0_2_fullscreen_quad_B.glsl");
|
||||
|
@ -18762,7 +18787,7 @@ void fullscreen_quad_ycbcr_flipped( texture_t textureYCbCr[3] ) {
|
|||
glGenVertexArrays( 1, (GLuint*)&vao );
|
||||
}
|
||||
|
||||
// glEnable( GL_BLEND );
|
||||
renderstate_apply(&fullscreen_quad_rs);
|
||||
glUseProgram( program );
|
||||
// glUniform1f( u_gamma, gamma );
|
||||
|
||||
|
|
Loading…
Reference in New Issue