Skip to content
This repository
Browse code

fix ass subs for GLES

  • Loading branch information...
commit 192184a0497eed928c9e562735654fb33e139ac6 1 parent 6eff7a8
Rainer Hochecker authored February 21, 2013
33  xbmc/cores/VideoRenderers/OverlayRendererGL.cpp
@@ -374,7 +374,7 @@ COverlayGlyphGL::~COverlayGlyphGL()
374 374
 
375 375
 void COverlayGlyphGL::Render(SRenderState& state)
376 376
 {
377  
-  if (m_texture == 0)
  377
+  if ((m_texture == 0) || (m_count == 0))
378 378
     return;
379 379
 
380 380
   glEnable(GL_TEXTURE_2D);
@@ -433,21 +433,32 @@ void COverlayGlyphGL::Render(SRenderState& state)
433 433
   GLint colLoc  = g_Windowing.GUIShaderGetCol();
434 434
   GLint tex0Loc = g_Windowing.GUIShaderGetCoord0();
435 435
 
436  
-  glVertexAttribPointer(posLoc,  3, GL_FLOAT,         GL_FALSE, sizeof(VERTEX), (char*)m_vertex + offsetof(VERTEX, x));
437  
-  glVertexAttribPointer(colLoc,  4, GL_UNSIGNED_BYTE, GL_TRUE,  sizeof(VERTEX), (char*)m_vertex + offsetof(VERTEX, r));
438  
-  glVertexAttribPointer(tex0Loc, 2, GL_FLOAT,         GL_FALSE, sizeof(VERTEX), (char*)m_vertex + offsetof(VERTEX, u));
  436
+  // stack object until VBOs will be used
  437
+  std::vector<VERTEX> vecVertices( 6 * m_count);
  438
+  VERTEX *vertices = &vecVertices[0];
  439
+
  440
+  for (int i=0; i<m_count*4; i+=4)
  441
+  {
  442
+    *vertices++ = m_vertex[i];
  443
+    *vertices++ = m_vertex[i+1];
  444
+    *vertices++ = m_vertex[i+2];
  445
+
  446
+    *vertices++ = m_vertex[i+1];
  447
+    *vertices++ = m_vertex[i+3];
  448
+    *vertices++ = m_vertex[i+2];
  449
+  }
  450
+
  451
+  vertices = &vecVertices[0];
  452
+
  453
+  glVertexAttribPointer(posLoc,  3, GL_FLOAT,         GL_FALSE, sizeof(VERTEX), (char*)vertices + offsetof(VERTEX, x));
  454
+  glVertexAttribPointer(colLoc,  4, GL_UNSIGNED_BYTE, GL_TRUE,  sizeof(VERTEX), (char*)vertices + offsetof(VERTEX, r));
  455
+  glVertexAttribPointer(tex0Loc, 2, GL_FLOAT,         GL_FALSE, sizeof(VERTEX), (char*)vertices + offsetof(VERTEX, u));
439 456
 
440 457
   glEnableVertexAttribArray(posLoc);
441 458
   glEnableVertexAttribArray(colLoc);
442 459
   glEnableVertexAttribArray(tex0Loc);
443 460
 
444  
-  // GLES2 version
445  
-  // As using triangle strips, have to do in sets of 4.
446  
-  // This is due to limitations of ES, in that tex/col has to be same size as ver!
447  
-  for (int i=0; i<(m_count*4); i+=4)
448  
-  {
449  
-    glDrawArrays(GL_TRIANGLE_STRIP, i, 4);
450  
-  }
  461
+  glDrawArrays(GL_TRIANGLES, 0, vecVertices.size());
451 462
 
452 463
   glDisableVertexAttribArray(posLoc);
453 464
   glDisableVertexAttribArray(colLoc);

0 notes on commit 192184a

Please sign in to comment.
Something went wrong with that request. Please try again.