(Menu) Have default tex coords array

This commit is contained in:
twinaphex 2015-11-02 22:46:23 +01:00
parent 8e5a2fdc77
commit 2a100d730c
3 changed files with 37 additions and 37 deletions

View File

@ -102,14 +102,6 @@ typedef struct materialui_handle
gfx_font_raster_block_t list_block;
} materialui_handle_t;
static const GRfloat materialui_tex_coords[] = {
0, 1,
1, 1,
0, 0,
1, 0
};
static void materialui_context_reset_textures(materialui_handle_t *materialui, const char *iconpath)
{
unsigned i;
@ -181,8 +173,8 @@ static void materialui_draw_icon(materialui_handle_t *materialui,
coords.vertices = 4;
coords.vertex = NULL;
coords.tex_coord = materialui_tex_coords;
coords.lut_tex_coord = materialui_tex_coords;
coords.tex_coord = NULL;
coords.lut_tex_coord = NULL;
coords.color = (const float*)color;
menu_display_draw_frame(
@ -236,8 +228,8 @@ static void materialui_render_quad(int x, int y, int w, int h,
coords.vertices = 4;
coords.vertex = NULL;
coords.tex_coord = materialui_tex_coords;
coords.lut_tex_coord = materialui_tex_coords;
coords.tex_coord = NULL;
coords.lut_tex_coord = NULL;
coords.color = coord_color;
menu_display_blend_begin();
@ -569,8 +561,8 @@ static void materialui_draw_cursor(materialui_handle_t *materialui,
coords.vertices = 4;
coords.vertex = NULL;
coords.tex_coord = materialui_tex_coords;
coords.lut_tex_coord = materialui_tex_coords;
coords.tex_coord = NULL;
coords.lut_tex_coord = NULL;
coords.color = (const float*)color;
menu_display_blend_begin();
@ -701,7 +693,7 @@ static void materialui_frame(void)
width, height,
materialui->textures.white, 0.75f, false,
&white_transp_bg[0], &white_bg[0],
NULL, &materialui_tex_coords[0], 4,
NULL, NULL, 4,
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
}
else
@ -723,7 +715,7 @@ static void materialui_frame(void)
width, height,
materialui->textures.bg.id, 0.75f, true,
&white_transp_bg[0], &white_bg[0],
NULL, &materialui_tex_coords[0], 4,
NULL, NULL, 4,
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
/* Restore opacity of transposed white background */

View File

@ -223,13 +223,6 @@ typedef struct xmb_handle
gfx_font_raster_block_t raster_block;
} xmb_handle_t;
static const GRfloat rmb_tex_coord[] = {
0, 1,
1, 1,
0, 0,
1, 0,
};
static void xmb_context_destroy_horizontal_list(xmb_handle_t *xmb,
menu_handle_t *menu);
static void xmb_init_horizontal_list(menu_handle_t *menu, xmb_handle_t *xmb);
@ -357,8 +350,8 @@ static void xmb_draw_icon(xmb_handle_t *xmb,
coords.vertices = 4;
coords.vertex = NULL;
coords.tex_coord = rmb_tex_coord;
coords.lut_tex_coord = rmb_tex_coord;
coords.tex_coord = NULL;
coords.lut_tex_coord = NULL;
coords.color = (const float*)color;
menu_display_draw_frame(
@ -389,8 +382,8 @@ static void xmb_draw_icon_predone(xmb_handle_t *xmb,
coords.vertices = 4;
coords.vertex = NULL;
coords.tex_coord = rmb_tex_coord;
coords.lut_tex_coord = rmb_tex_coord;
coords.tex_coord = NULL;
coords.lut_tex_coord = NULL;
coords.color = color;
menu_display_draw_frame(
@ -414,8 +407,8 @@ static void xmb_draw_boxart(xmb_handle_t *xmb, GRfloat *color, unsigned width, u
coords.vertices = 4;
coords.vertex = NULL;
coords.tex_coord = rmb_tex_coord;
coords.lut_tex_coord = rmb_tex_coord;
coords.tex_coord = NULL;
coords.lut_tex_coord = NULL;
coords.color = (const float*)color;
menu_display_draw_frame(
@ -1403,8 +1396,8 @@ static void xmb_draw_cursor(xmb_handle_t *xmb,
coords.vertices = 4;
coords.vertex = NULL;
coords.tex_coord = rmb_tex_coord;
coords.lut_tex_coord = rmb_tex_coord;
coords.tex_coord = NULL;
coords.lut_tex_coord = NULL;
coords.color = (const float*)color;
menu_display_blend_begin();
@ -1564,7 +1557,7 @@ static void xmb_frame(void)
menu_display_frame_background(
width, height, xmb->textures.bg.id, xmb->alpha, false, &coord_color[0],
&coord_color2[0], NULL, &rmb_tex_coord[0], 4,
&coord_color2[0], NULL, NULL, 4,
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
xmb_draw_text(menu, xmb,
@ -1670,7 +1663,7 @@ static void xmb_frame(void)
width, height,
xmb->textures.bg.id, xmb->alpha, true,
&coord_color[0], &coord_color2[0],
NULL, &rmb_tex_coord[0], 4,
NULL, NULL, 4,
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
xmb_frame_messagebox(msg);
}

View File

@ -524,6 +524,13 @@ static const GRfloat gl_vertexes[] = {
1, 1
};
static const GRfloat gl_tex_coords[] = {
0, 1,
1, 1,
0, 0,
1, 0
};
static GLenum menu_display_prim_to_gl_enum(enum menu_display_prim_type prim_type)
{
switch (prim_type)
@ -583,6 +590,10 @@ void menu_display_draw_frame(
mat = &gl->mvp_no_rot;
if (!coords->vertex)
coords->vertex = &gl_vertexes[0];
if (!coords->tex_coord)
coords->tex_coord = &gl_tex_coords[0];
if (!coords->lut_tex_coord)
coords->lut_tex_coord = &gl_tex_coords[0];
glViewport(x, y, width, height);
glBindTexture(GL_TEXTURE_2D, texture);
@ -608,8 +619,9 @@ void menu_display_frame_background(
size_t vertex_count,
enum menu_display_prim_type prim_type)
{
const GRfloat *new_vertex;
struct gfx_coords coords;
const GRfloat *new_vertex = NULL;
const GRfloat *new_tex_coord = NULL;
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
gl_t *gl = (gl_t*)video_driver_get_ptr(NULL);
@ -617,15 +629,18 @@ void menu_display_frame_background(
if (!gl)
return;
new_vertex = vertex;
new_vertex = vertex;
new_tex_coord = tex_coord;
if (!new_vertex)
new_vertex = &gl_vertexes[0];
if (!new_tex_coord)
new_tex_coord = &gl_tex_coords[0];
coords.vertices = vertex_count;
coords.vertex = new_vertex;
coords.tex_coord = tex_coord;
coords.lut_tex_coord = tex_coord;
coords.tex_coord = new_tex_coord;
coords.lut_tex_coord = new_tex_coord;
coords.color = (const float*)coord_color;
menu_display_blend_begin();