簡體   English   中英

將GL_TRIANGLE_STRIP顯示為線框

[英]Display GL_TRIANGLE_STRIP as wireframe

我正在努力讓一個opengl三角形條帶顯示為線框。 我的顯示算法看起來像這樣:

// want to display by strip here to allow for quick processing of each of the polygons that we need
// allow a quick strip of polygons to be drawn
glBegin(GL_TRIANGLE_STRIP); 
// set the triangle strip up for front-facing drawing to allow for clockwise
// glFrontFace(GL_CW);

// cache height / width etc of this element
int height = int(heightField->getHeight()),
    width = int(heightField->getWidth());   

// want to loop through each row, stopping one from the bottom
for (int y = height -2; y >= 0; --y) {

    // we want to circle for each element in the next for loop and counter-clockwise add our vertices to the point
    for (int x = 0; x < width - 2; ++x ) {

        // http://en.wikipedia.org/wiki/Triangle_strip -- for reference on the element
        glVertex3fv(heightField->getVertex(x, y+1));//add the left corner point -- point 1
        glVertex3fv(heightField->getVertex(x, y));//add the current point -- point 2
        glVertex3fv(heightField->getVertex(x+1, y+1));//add the next point -- point 3
        glVertex3fv(heightField->getVertex(x+1, y));//add the 4th point -- point 4
    }
}

// end the triangle strip   
glEnd();
glDisable(GL_POLYGON_OFFSET_LINE);

基本上,我正在做的是啟動gl_triangle_strip,然后繪制我的高度域對象中每個點的x,y,z坐標。

基本上這是一個大的白色斑點,我試圖只顯示不同點的線框。 有沒有人對如何做到這一點有任何想法?

glPolygonMode()一個鏡頭:

glPolygonMode( GL_FRONT, GL_LINE );

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM