2015-01-07 16:46:50 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
|
|
|
* Copyright (C) 2011-2015 - Daniel De Matteis
|
|
|
|
*
|
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2015-07-09 16:39:40 +00:00
|
|
|
#include <retro_miscellaneous.h>
|
2014-09-02 23:51:29 +00:00
|
|
|
|
2015-07-09 16:39:40 +00:00
|
|
|
#include "menu_video.h"
|
2015-05-02 17:09:23 +00:00
|
|
|
|
2015-08-19 23:40:19 +00:00
|
|
|
#ifdef HAVE_THREADS
|
2015-08-17 18:51:12 +00:00
|
|
|
#include "../gfx/video_thread_wrapper.h"
|
2015-08-19 23:40:19 +00:00
|
|
|
#endif
|
2015-07-12 04:16:30 +00:00
|
|
|
|
2015-04-27 01:37:04 +00:00
|
|
|
#ifdef HAVE_OPENGL
|
2015-07-09 16:39:40 +00:00
|
|
|
void menu_video_draw_frame(
|
2015-09-06 16:16:24 +00:00
|
|
|
unsigned x, unsigned y,
|
|
|
|
unsigned width, unsigned height,
|
2015-04-27 01:37:04 +00:00
|
|
|
const shader_backend_t *shader,
|
2015-07-12 01:57:06 +00:00
|
|
|
struct gfx_coords *coords,
|
2015-04-27 01:37:04 +00:00
|
|
|
math_matrix_4x4 *mat,
|
2015-04-27 03:00:07 +00:00
|
|
|
bool blend,
|
|
|
|
GLuint texture
|
|
|
|
)
|
2015-04-27 01:37:04 +00:00
|
|
|
{
|
|
|
|
driver_t *driver = driver_get_ptr();
|
2015-04-27 03:00:07 +00:00
|
|
|
|
2015-09-06 16:16:24 +00:00
|
|
|
glViewport(x, y, width, height);
|
2015-04-27 03:00:07 +00:00
|
|
|
glBindTexture(GL_TEXTURE_2D, texture);
|
|
|
|
|
2015-04-27 01:37:04 +00:00
|
|
|
shader->set_coords(coords);
|
|
|
|
shader->set_mvp(driver->video_data, mat);
|
|
|
|
|
|
|
|
if (blend)
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
|
|
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
|
|
|
|
|
|
|
if (blend)
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
}
|
2015-04-27 02:37:45 +00:00
|
|
|
|
2015-07-09 16:39:40 +00:00
|
|
|
void menu_video_frame_background(
|
2015-04-27 02:37:45 +00:00
|
|
|
menu_handle_t *menu,
|
|
|
|
settings_t *settings,
|
|
|
|
gl_t *gl,
|
|
|
|
GLuint texture,
|
|
|
|
float handle_alpha,
|
2015-09-06 15:45:16 +00:00
|
|
|
bool force_transparency,
|
2015-09-06 18:53:52 +00:00
|
|
|
GRfloat *coord_color,
|
|
|
|
const GRfloat *vertex,
|
|
|
|
const GRfloat *tex_coord)
|
2015-04-27 02:37:45 +00:00
|
|
|
{
|
2015-07-12 01:57:06 +00:00
|
|
|
struct gfx_coords coords;
|
2015-09-06 16:16:24 +00:00
|
|
|
unsigned width, height;
|
2015-09-06 18:53:52 +00:00
|
|
|
GRfloat color[16];
|
2015-04-27 02:37:45 +00:00
|
|
|
|
2015-06-30 17:04:19 +00:00
|
|
|
global_t *global = global_get_ptr();
|
2015-04-27 02:37:45 +00:00
|
|
|
|
2015-06-30 17:04:19 +00:00
|
|
|
color[ 0] = 1.0f;
|
|
|
|
color[ 1] = 1.0f;
|
|
|
|
color[ 2] = 1.0f;
|
|
|
|
color[ 3] = handle_alpha;
|
|
|
|
color[ 4] = 1.0f;
|
|
|
|
color[ 5] = 1.0f;
|
|
|
|
color[ 6] = 1.0f;
|
|
|
|
color[ 7] = handle_alpha;
|
|
|
|
color[ 8] = 1.0f;
|
|
|
|
color[ 9] = 1.0f;
|
|
|
|
color[10] = 1.0f;
|
|
|
|
color[11] = handle_alpha;
|
|
|
|
color[12] = 1.0f;
|
|
|
|
color[13] = 1.0f;
|
|
|
|
color[14] = 1.0f;
|
|
|
|
color[15] = handle_alpha;
|
2015-04-27 02:37:45 +00:00
|
|
|
|
|
|
|
coords.vertices = 4;
|
|
|
|
coords.vertex = vertex;
|
|
|
|
coords.tex_coord = tex_coord;
|
|
|
|
coords.lut_tex_coord = tex_coord;
|
2015-09-06 15:45:16 +00:00
|
|
|
coords.color = (const float*)coord_color;
|
2015-04-27 02:37:45 +00:00
|
|
|
|
2015-06-26 12:38:42 +00:00
|
|
|
if (gl->shader && gl->shader->use)
|
|
|
|
gl->shader->use(gl, GL_SHADER_STOCK_BLEND);
|
|
|
|
|
2015-05-12 12:41:01 +00:00
|
|
|
menu_display_set_viewport();
|
2015-04-27 02:37:45 +00:00
|
|
|
|
|
|
|
if ((settings->menu.pause_libretro
|
2015-07-27 15:18:10 +00:00
|
|
|
|| !global->inited.main || (global->inited.core.type == CORE_TYPE_DUMMY))
|
2015-04-27 02:37:45 +00:00
|
|
|
&& !force_transparency
|
|
|
|
&& texture)
|
|
|
|
coords.color = color;
|
2015-04-27 02:44:57 +00:00
|
|
|
|
2015-09-06 16:16:24 +00:00
|
|
|
video_driver_get_size(&width, &height);
|
|
|
|
|
|
|
|
menu_video_draw_frame(0, 0, width, height,
|
|
|
|
gl->shader, &coords,
|
2015-04-27 03:00:07 +00:00
|
|
|
&gl->mvp_no_rot, true, texture);
|
2015-04-27 02:37:45 +00:00
|
|
|
|
|
|
|
gl->coords.color = gl->white_color_ptr;
|
|
|
|
}
|
2015-04-27 01:37:04 +00:00
|
|
|
#endif
|
2015-08-17 18:51:12 +00:00
|
|
|
|
|
|
|
const char *menu_video_get_ident(void)
|
|
|
|
{
|
2015-08-19 23:40:19 +00:00
|
|
|
#ifdef HAVE_THREADS
|
2015-08-19 23:41:08 +00:00
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
|
2015-08-17 18:51:12 +00:00
|
|
|
if (settings->video.threaded)
|
|
|
|
return rarch_threaded_video_get_ident();
|
2015-08-19 23:40:19 +00:00
|
|
|
#endif
|
2015-08-17 18:51:12 +00:00
|
|
|
|
|
|
|
return video_driver_get_ident();
|
|
|
|
}
|