1

I'm using LWJGL and an icosahedron-subdivide-algorithm to create icosphere meshes.

I was using glDrawElements to render the spheres and they looked like this , but I was hoping for a more low-poly look.

After some research I found that glDrawArrays can achieve a low-poly look, so I switched to glDrawArrays. Without changing anything about the spheres themselves (vertices array, indices array, etc.), they now look like this.

Even the primary icosahedron is completely off. I've played around with the icosahedron's base vertices and arrays (which the subdivide algorithm uses to create the spheres) to see where things go amiss, but I can't wrap my ahead around what's going wrong.

It might also be worth mentioning I use GL_TRIANGLES in both glDrawElements and glDrawArrays.

Any insight would be great.

haji beats
  • 11
  • 2
  • 2
    Not sure where you're going with this. `glDrawArrays()` will use the vertices in their original order, without using indices at all. So if you built geometry that relies on indexed vertices, of course it will render it completely wrong. – Reto Koradi Jul 03 '16 at 05:43
  • I tried rearranging the vertices by hand (which wasn't easy) with no luck. And if I don't include indices the model doesn't show up at all. That's good info though, I didn't know that about glDrawArrays(). Is that true for both GL_TRIANGLES and GL_TRIANGLE_STRIP? – haji beats Jul 03 '16 at 06:36
  • 1
    It's not clear what you think you're trying to accomplish with glDrawArrays and glDrawElements. The *only difference* between them is that one uses indices and the other does not. So generally speaking, you cannot simply switch between the two and expect to get the same result. – Nicol Bolas Jul 03 '16 at 13:01
  • 3
    Yes, that doesn't depend on the primitive type at all. Another way of describing it is that `glDrawArrays()` is equivalent to using `glDrawElements()` with an index array containing the sequence (0, 1, 2, 3, ... , n-1), with n the number of vertices. – Reto Koradi Jul 03 '16 at 13:36

0 Answers0