Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下...
GLfloat test[8] = {-0.3f,-0.4f,0.3f,0.4f,0.2f,-0.4f,-0.2f,0.4f}; glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, test); glEnableVertexAttribArray(0); glDrawArrays(GL_LINES, 0, 8);
问题是当它被渲染时它看起来像这样......
任何人都可以帮助我解决我所缺少的吗?我对OpenGL相当陌生
哎呀我找到了...
glDrawArrays(GL_LINES, 0, 8);
我认为这里的 8 是数组中的条目数,但它实际上是向量的数量(每个向量 2 个点)。因此,将 8 除以 2 (4) 即可得出预期结果。