1

I'm struggling to get an opengl triangle strip to display as a wireframe. My display algorithm looks something like this:

// 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);

Basically, what I'm doing is starting the gl_triangle_strip and then plotting the x,y,z coordinates for each point in my heightfield object.

Basically what this draws out is a big white blob, I'm trying to show just the wireframe of the different points. Does anyone have any ideas on how to do this?

JonMorehouse
  • 1,313
  • 6
  • 14
  • 34

1 Answers1

4

Give glPolygonMode() a shot:

glPolygonMode( GL_FRONT, GL_LINE );
genpfault
  • 51,148
  • 11
  • 85
  • 139
  • hello, I tried this and am still getting just a bunch of white filled in polygons. Any other ideas? – JonMorehouse Feb 20 '13 at 23:24
  • You can use GL_LINE_STRIP - it draws most of the lines in what you want. You can fill in the rest if you want a complete wireframe. – Jim Andreas Feb 06 '16 at 04:26