| 407 | } |
| 408 | |
| 409 | void OglRenderer::renderPolyline(shapeObj *p, colorObj *c, double width, |
| 410 | int patternlength, double* pattern, int lineCap, int joinStyle, |
| 411 | colorObj *outlinecolor, double outlinewidth) |
| 412 | { |
| 413 | makeCurrent(); |
| 414 | if (outlinecolor) |
| 415 | { |
| 416 | glEnable(GL_DEPTH_TEST); |
| 417 | glPushMatrix(); |
| 418 | glTranslated(0, 0, 1); |
| 419 | } |
| 420 | |
| 421 | setColor(c); |
| 422 | |
| 423 | if (patternlength > 0) |
| 424 | { |
| 425 | if (p->renderer_cache == NULL) |
| 426 | { |
| 427 | loadLine(p, width, patternlength, pattern); |
| 428 | } |
| 429 | /* FIXME */ |
| 430 | if (p->renderer_cache == NULL) |
| 431 | return; |
| 432 | OglCache* cache = (OglCache*) p->renderer_cache; |
| 433 | GLuint texture = cache->texture; |
| 434 | if (cache->patternDistance > 0) |
| 435 | { |
| 436 | glBindTexture(GL_TEXTURE_2D, texture); |
| 437 | double place = 0; |
| 438 | glBegin(GL_TRIANGLE_STRIP); |
| 439 | for (int j = 0; j < p->numlines; j++) |
| 440 | { |
| 441 | for (int i = 0; i < p->line[j].numpoints - 1; i++) |
| 442 | { |
| 443 | double dist = drawTriangles(&p->line[j].point[i], |
| 444 | &p->line[j].point[i + 1], width, |
| 445 | cache->patternDistance, place |
| 446 | / cache->patternDistance); |
| 447 | place = (place + dist); |
| 448 | while (place >= cache->patternDistance) |
| 449 | place -= cache->patternDistance; // better than mod, no rounding |
| 450 | } |
| 451 | } |
| 452 | glEnd(); |
| 453 | glBindTexture(GL_TEXTURE_2D, 0); |
| 454 | } |
| 455 | } |
| 456 | else |
| 457 | { |
| 458 | float widthRange[2]; |
| 459 | glGetFloatv(GL_LINE_WIDTH_RANGE, widthRange); |
| 460 | bool quads = !(width >= widthRange[0] && width <= widthRange[1]); |
| 461 | double circleScale = width / SHAPE_CIRCLE_RADIUS / 2; |
| 462 | glLineWidth(width); |
| 463 | if (quads || (width > 1.0 && (lineCap == MS_CJC_ROUND || joinStyle == MS_CJC_ROUND))) |
| 464 | { |
| 465 | for (int j = 0; j < p->numlines; j++) |
| 466 | { |