我是一个老的glBegin()程序员,我需要移植这个结构
结构行{ float color3;float vertices2;};
一种更新的绘画范式。假设着色器没问题,如何用glDrawArrays或glDrawElements来绘制呢?
谢谢,麦克风。
发布于 2013-10-28 18:24:52
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(float) * 3, lines->vertices);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(float) * 3, lines->color);
glDrawElements(GL_LINES, 2, GL_UNSIGNED_SHORT, line_indices);假设你已经指定了顶点着色器的‘位置’和‘颜色’顶点属性为0和1。索引数组应该类似于GLshort indices[] = { 0, 1 };。
https://stackoverflow.com/questions/19631836
复制相似问题