No display from glDrawElements

后端 未结 3 1489
孤独总比滥情好
孤独总比滥情好 2021-02-13 18:27

When I use glDrawArrays I get a triangle in the middle of my screen, as expected. But when I try to use glDrawElements nothing comes up at all.

I have tried all sorts of

3条回答
  •  迷失自我
    2021-02-13 18:40

    I would start your index at zero as others have pointed out. But there is one other problem I see...

    glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &index);
    

    should be...

    glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, index);
    

    ...as index is an array, it is already a pointer, no need for &.

提交回复
热议问题