Had a look at that tutorial I found, understood most of it. Then took another look at my code, and found out that I had been using a wrong array for one set of vertices. Once I corrected that, my current code actually worked. Go figure. Its bugs like that, which is hardest to track down, especially when you have staired yourself blind looking at the same code for hours on end.
Thanks for everyones input so far.
Thanks for everyones input so far.