2
我畫我的觀點類似:貼花紋理使用glTextCoordPointer
TAB_PAS = 2;
glVertexPointer(TAB_PAS,GL_FLOAT,0,test[0].send_terrain());
glDrawElements(GL_LINES, indice_degra_de.size(), GL_UNSIGNED_INT, indice_degra_de.constData());
glVertexPointer(TAB_PAS,GL_FLOAT,0,test[1].send_terrain());
glDrawElements(GL_LINES, indice_degra.size(), GL_UNSIGNED_INT, indice_degra.constData());
glVertexPointer(TAB_PAS,GL_FLOAT,0,test[2].send_terrain());
glDrawElements(GL_LINES, indice_degra_de.size(), GL_UNSIGNED_INT, indice_degra_de.constData());
glVertexPointer(TAB_PAS,GL_FLOAT,0,test[3].send_terrain());
它吸引了大地形。
所以現在,我想爲例子貼上地板紋理。我看到一個功能glTexCoordPointer
,但我不知道如何使用它:
glTexCoordPointer(2, GL_FLOAT, 0, test[0].send_terrain());
// Something like that ?
我已經上傳了我的picture.tga,所以現在的問題是貼花它。
謝謝你。你如何計算Tex Coord? – user3243742
這裏是關於紋理的簡短教程。它以一個紋理座標爲例結束:http://www.gamedev.net/page/resources/_/technical/opengl/opengl-texture-mapping-an-introduction-r947 – user1781290