]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
reenabled index buffers on GLES2 path
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 27 Jun 2013 06:55:10 +0000 (06:55 +0000)
committerRudolf Polzer <divverent@xonotic.org>
Thu, 27 Jun 2013 17:31:27 +0000 (19:31 +0200)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11962 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=cac6f0a6362c2c75dc6e80717f4fe4a452db0533

gl_backend.c

index a03060c1d33ca4f4b97f38f4e8eba2ba3ab347e7..1b32c34662f4b67ab0934972cc383ca77d92afdb 100644 (file)
@@ -3209,44 +3209,28 @@ void R_Mesh_Draw(int firstvertex, int numvertices, int firsttriangle, int numtri
                        break;
                case RENDERPATH_GLES1:
                case RENDERPATH_GLES2:
-                       // GLES does not have glDrawRangeElements, and generally
-                       // underperforms with index buffers, so this code path is
-                       // relatively straightforward...
-#if 0
-                       if (gl_paranoid.integer)
+                       // GLES does not have glDrawRangeElements so this is a bit shorter than the GL20 path
+                       if (bufferobject3s)
                        {
-                               int r, prog, enabled, i;
-                               GLsizei         attriblength;
-                               GLint           attribsize;
-                               GLenum          attribtype;
-                               GLchar          attribname[1024];
-                               r = qglCheckFramebufferStatusEXT(GL_FRAMEBUFFER);CHECKGLERROR
-                               if (r != GL_FRAMEBUFFER_COMPLETE)
-                                       Con_DPrintf("fbo %i not complete (default %i)\n", gl_state.framebufferobject, gl_state.defaultframebufferobject);
-#ifndef GL_CURRENT_PROGRAM
-#define GL_CURRENT_PROGRAM 0x8B8D
-#endif
-                               qglGetIntegerv(GL_CURRENT_PROGRAM, &r);CHECKGLERROR
-                               if (r < 0 || r > 10000)
-                                       Con_DPrintf("GL_CURRENT_PROGRAM = %i\n", r);
-                               prog = r;
-                               for (i = 0;i < 8;i++)
-                               {
-                                       qglGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &r);CHECKGLERROR
-                                       if (!r)
-                                               continue;
-                                       qglGetActiveAttrib(prog, i, sizeof(attribname), &attriblength, &attribsize, &attribtype, attribname);CHECKGLERROR
-                                       Con_DPrintf("prog %i position %i length %i size %04X type %i name \"%s\"\n", prog, i, (int)attriblength, (int)attribsize, (int)attribtype, (char *)attribname);
-                               }
+                               GL_BindEBO(bufferobject3s);
+                               qglDrawElements(GL_TRIANGLES, numelements, GL_UNSIGNED_SHORT, (void *)bufferoffset3s);
+                               CHECKGLERROR
                        }
-#endif
-                       if (element3s)
+                       else if (bufferobject3i)
                        {
+                               GL_BindEBO(bufferobject3i);
+                               qglDrawElements(GL_TRIANGLES, numelements, GL_UNSIGNED_INT, (void *)bufferoffset3i);
+                               CHECKGLERROR
+                       }
+                       else if (element3s)
+                       {
+                               GL_BindEBO(0);
                                qglDrawElements(GL_TRIANGLES, numelements, GL_UNSIGNED_SHORT, element3s);
                                CHECKGLERROR
                        }
                        else if (element3i)
                        {
+                               GL_BindEBO(0);
                                qglDrawElements(GL_TRIANGLES, numelements, GL_UNSIGNED_INT, element3i);
                                CHECKGLERROR
                        }