我想使用 glDrawElements 绘制一个多边形。使用 glDrawArrays 一切都很好,但 glDrawElements 什么也没有绘制。
这是我的代码:
float[] polys = {
0f,0f,0f,
0f,0f,-1f,
-1f,0f,-1f,
-1f,0f,0f
};
int[] indexs = {
0,1,2,
3,4,5,
6,7,8,
9,10,11
};
float[] texs = {
0f,0f,
0f,1f,
1f,1f,
1f,0f
};
FloatBuffer buff_polys = new FloatBuffer(polys.length).put(polys).normalize();
IntegerBuffer buff_indexs = new IntegerBuffer(indexs.length).put(indexs).normalize();
FloatBuffer buff_texs = new FloatBuffer(texs.length).put(texs).normalize();
GL11.glVertexPointer(3, 0, buff_polys.getBuffer());
GL11.glTexCoordPointer(2, 0, buff_texs.getBuffer());
//GL11.glDrawArrays(GL11.GL_QUADS, 0, buff_polys.size()/3);
GL11.glDrawElements(GL11.GL_QUADS, buff_indexs.getBuffer());
帮助!可能是什么问题?