首页 > iOS端使用OpenGLES实现STL模型文件的展示,为什么glDrawArrays的渲染失败?

iOS端使用OpenGLES实现STL模型文件的展示,为什么glDrawArrays的渲染失败?

facet normal 0.000000e+00 -7.071068e+00 0.000000e+00

outer loop
  vertex   -2.990727e+00 -1.406490e+01 -1.000000e+00
  vertex   -2.990727e+00 -1.406490e+01 1.000000e+00
  vertex   -4.990727e+00 -1.406490e+01 1.000000e+00
endloop

endfacet
如题,我已经取到整个stl文件的数据并保存在数组内,现在用opengl想要渲染这些顶点及法向量。
目前知道用glDrawArrays去渲染

glVertexAttribPointer(_positionSlot, 3, GL_FLOAT, GL_FALSE, 0, vertices1 );
    glEnableVertexAttribArray(_positionSlot);
    // Draw triangle
    glDrawArrays(GL_TRIANGLES, 0, 3);

上面代码是我渲染一个三角形时候用到,那么现在我卡住的是,我所获取的stl内容的数组与opengl所需的数组是不是同一种数据类型,因为我将自己数组替代vertices1后没有效果。
另外在我的尝试中没有找到存入normal 0.000000e+00 -7.071068e+00 0.000000e+00法向量的位置,请教各位一下,我该如何去渲染这个数据!!!

【热门文章】
【热门文章】