From 015ce797f9a4f6879ffa50e67a25ba480a00f9d5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 27 Apr 2015 05:00:07 +0200 Subject: [PATCH] (Menu) Cleanups --- menu/drivers/glui.c | 4 +--- menu/drivers/shared.h | 11 +++++++---- menu/drivers/xmb.c | 11 ++++------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index fb40bdd4c4..1909358f0c 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -140,10 +140,8 @@ static void glui_render_quad(gl_t *gl, int x, int y, int w, int h, coords.lut_tex_coord = tex_coord; coords.color = color; - glBindTexture(GL_TEXTURE_2D, 0); - - menu_gl_draw_frame(gl->shader, &coords, &gl->mvp_no_rot, true); + menu_gl_draw_frame(gl->shader, &coords, &gl->mvp_no_rot, true, 0); gl->coords.color = gl->white_color_ptr; } diff --git a/menu/drivers/shared.h b/menu/drivers/shared.h index c43c2c7740..659e75acde 100644 --- a/menu/drivers/shared.h +++ b/menu/drivers/shared.h @@ -28,9 +28,14 @@ static INLINE void menu_gl_draw_frame( const shader_backend_t *shader, struct gl_coords *coords, math_matrix_4x4 *mat, - bool blend) + bool blend, + GLuint texture + ) { driver_t *driver = driver_get_ptr(); + + glBindTexture(GL_TEXTURE_2D, texture); + shader->set_coords(coords); shader->set_mvp(driver->video_data, mat); @@ -100,10 +105,8 @@ static INLINE void gl_menu_frame_background( && texture) coords.color = color; - glBindTexture(GL_TEXTURE_2D, texture); - menu_gl_draw_frame(gl->shader, &coords, - &gl->mvp_no_rot, true); + &gl->mvp_no_rot, true, texture); gl->coords.color = gl->white_color_ptr; } diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index a2486a289b..18baa1bc44 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -314,7 +314,6 @@ static void xmb_draw_icon(gl_t *gl, xmb_handle_t *xmb, coords.tex_coord = rmb_tex_coord; coords.lut_tex_coord = rmb_tex_coord; coords.color = color; - glBindTexture(GL_TEXTURE_2D, texture); matrix_4x4_rotate_z(&mrot, rotation); matrix_4x4_multiply(&mymat, &mrot, &gl->mvp_no_rot); @@ -322,7 +321,7 @@ static void xmb_draw_icon(gl_t *gl, xmb_handle_t *xmb, matrix_4x4_scale(&mscal, scale_factor, scale_factor, 1); matrix_4x4_multiply(&mymat, &mscal, &mymat); - menu_gl_draw_frame(gl->shader, &coords, &mymat, false); + menu_gl_draw_frame(gl->shader, &coords, &mymat, false, texture); } static void xmb_draw_icon_predone(gl_t *gl, xmb_handle_t *xmb, @@ -363,9 +362,8 @@ static void xmb_draw_icon_predone(gl_t *gl, xmb_handle_t *xmb, coords.tex_coord = rmb_tex_coord; coords.lut_tex_coord = rmb_tex_coord; coords.color = color; - glBindTexture(GL_TEXTURE_2D, texture); - menu_gl_draw_frame(gl->shader, &coords, mymat, false); + menu_gl_draw_frame(gl->shader, &coords, mymat, false, texture); } static void xmb_draw_text(menu_handle_t *menu, @@ -1146,13 +1144,12 @@ static void xmb_draw_cursor(gl_t *gl, xmb_handle_t *xmb, float x, float y) coords.lut_tex_coord = rmb_tex_coord; coords.color = color; - glBindTexture(GL_TEXTURE_2D, xmb->textures.list[XMB_TEXTURE_POINTER].id); - matrix_4x4_rotate_z(&mrot, 0); matrix_4x4_multiply(&mymat, &mrot, &gl->mvp_no_rot); xmb_draw_icon_begin(gl); - menu_gl_draw_frame(gl->shader, &coords, &mymat, true); + + menu_gl_draw_frame(gl->shader, &coords, &mymat, true, xmb->textures.list[XMB_TEXTURE_POINTER].id); } static void xmb_render(void)