Demos (master): line-sample: use GL_LINE_STRIP instead of GL_LINE_LOOP
Brian Paul
brianp at kemper.freedesktop.org
Wed Feb 25 20:19:45 UTC 2015
Module: Demos
Branch: master
Commit: 0dfa8f7003bbf7296b0b0b55fdadde0d0b41f373
URL: http://cgit.freedesktop.org/mesa/demos/commit/?id=0dfa8f7003bbf7296b0b0b55fdadde0d0b41f373
Author: Brian Paul <brianp at vmware.com>
Date: Wed Feb 25 13:19:04 2015 -0700
line-sample: use GL_LINE_STRIP instead of GL_LINE_LOOP
The svga driver (and maybe others) decompose line loops into disjoint
lines so the line stipple counter isn't preserved from one segment to
the next. Use GL_LINE_STRIP instead to work around that.
---
src/tests/line-sample.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/tests/line-sample.c b/src/tests/line-sample.c
index ae5e056..70709b4 100644
--- a/src/tests/line-sample.c
+++ b/src/tests/line-sample.c
@@ -60,8 +60,8 @@ draw_line_sample(GLboolean smooth, GLboolean stipple, GLfloat width)
glEnd();
/* circle */
- glBegin(GL_LINE_LOOP);
- for (i = 0; i < 360; i += 10) {
+ glBegin(GL_LINE_STRIP);
+ for (i = 0; i <= 360; i += 10) {
float x = r2 * cos(i * M_PI / 180.0);
float y = r2 * sin(i * M_PI / 180.0);
@@ -70,11 +70,12 @@ draw_line_sample(GLboolean smooth, GLboolean stipple, GLfloat width)
glEnd();
/* box */
- glBegin(GL_LINE_LOOP);
+ glBegin(GL_LINE_STRIP);
glVertex2f(-r3, -r3);
glVertex2f( r3, -r3);
glVertex2f( r3, r3);
glVertex2f(-r3, r3);
+ glVertex2f(-r3, -r3);
glEnd();
}
More information about the mesa-commit
mailing list