Ejemplo n.º 1
0
static void *menu_display_gl_get_default_mvp(void)
{
   gl_t *gl = gl_get_ptr();

   if (!gl)
      return NULL;

   return &gl->mvp_no_rot;
}
Ejemplo n.º 2
0
static void menu_display_gl_draw_bg(
      unsigned width,
      unsigned height,
      uintptr_t texture,
      float handle_alpha,
      bool force_transparency,
      GLfloat *coord_color,
      GLfloat *coord_color2,
      const float *vertex,
      const float *tex_coord,
      size_t vertex_count,
      enum menu_display_prim_type prim_type)
{
   struct gfx_coords coords;
   const GLfloat *new_vertex    = NULL;
   const GLfloat *new_tex_coord = NULL;
   global_t     *global = global_get_ptr();
   settings_t *settings = config_get_ptr();
   gl_t             *gl = gl_get_ptr();

   if (!gl)
      return;

   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     = new_tex_coord;
   coords.lut_tex_coord = new_tex_coord;
   coords.color         = (const float*)coord_color;

   menu_display_gl_blend_begin();

   menu_display_ctl(MENU_DISPLAY_CTL_SET_VIEWPORT, NULL);

   if ((settings->menu.pause_libretro
      || !global->inited.main || (global->inited.core.type == CORE_TYPE_DUMMY))
      && !force_transparency
      && texture)
      coords.color = (const float*)coord_color2;

   menu_display_gl_draw(0, 0, width, height,
         &coords, (math_matrix_4x4*)menu_display_gl_get_default_mvp(),
         (GLuint)texture, prim_type);

   menu_display_gl_blend_end();

   gl->coords.color = gl->white_color_ptr;
}
Ejemplo n.º 3
0
static void menu_display_gl_draw(
      float x, float y,
      unsigned width, unsigned height,
      struct gfx_coords *coords,
      void *matrix_data,
      uintptr_t texture,
      enum menu_display_prim_type prim_type
      )
{
   gl_t             *gl = gl_get_ptr();
   math_matrix_4x4 *mat = (math_matrix_4x4*)matrix_data;

   if (!gl)
      return;

   /* TODO - edge case */
   if (height <= 0)
      height = 1;

   if (!mat)
      mat = (math_matrix_4x4*)menu_display_gl_get_default_mvp();
   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, (GLuint)texture);

   video_shader_driver_set_coords(gl, coords);
   video_shader_driver_set_mvp(gl, mat);

   glDrawArrays(menu_display_prim_to_gl_enum(prim_type), 0, coords->vertices);

   gl->coords.color     = gl->white_color_ptr;
}