Reputation: 137
So I have a vertex array batcher, and I want to use it to render rectangles that are lines instead of filled in. Currently I am using glPolyGonMode()
, but since my "shapes" are all uploaded to the graphics card as triangles, I get a line running down the middle of my rectangle, like this:
Obviously this is happening because there are two triangles to a rectangle. But I want to render only the rectangle without the middle line. How could I accomplish this?
Upvotes: 0
Views: 3466
Reputation: 8717
You can't do this with triangle list, triangle is the essential primitive to build up 3D models. you need two triangles to build up the rectangle.
If you don't want the middle line
Draw with GL_QUADS:
glBegin(GL_QUADS) ;
glVertex3f(0.0, 0.0, 0.0);
glVertex3f(0.0, 0.5, 0.0);
glVertex3f(0.5, 0.5, 0.0);
glVertex3f(0.5, 0.0, 0.0);
glEnd() ;
Draw with LINE_LOOP:
glBegin(GL_LINE_LOOP) ;
glVertex3f(0.0, 0.0, 0.0);
glVertex3f(0.0, 0.5, 0.0);
glVertex3f(0.5, 0.5, 0.0);
glVertex3f(0.5, 0.0, 0.0);
glEnd() ;
Upvotes: 2