| 522 | } |
| 523 | |
| 524 | void OglRenderer::renderPolygon(shapeObj *p, colorObj *color, colorObj *outlinecolor, double outlinewidth, const OglCachePtr& tile, int lineCap, int joinStyle) |
| 525 | { |
| 526 | /* |
| 527 | OpenGL cannot draw complex polygons so we need to use a Tessallator to draw the polygon using a GL_TRIANGLE_FAN |
| 528 | |
| 529 | ISSUE: There's a problem here. It would seem that changing the dimensions or bounding box area breaks the code. |
| 530 | Reports need for a combine callback. |
| 531 | */ |
| 532 | makeCurrent(); |
| 533 | std::vector<GLdouble*> pointers; |
| 534 | double texWidth = 0; |
| 535 | double texHeight = 0; |
| 536 | |
| 537 | if (tile) |
| 538 | { |
| 539 | glBindTexture(GL_TEXTURE_2D, tile->texture); // Select Our Texture |
| 540 | texWidth = tile->width; |
| 541 | texHeight = tile->height; |
| 542 | } |
| 543 | setColor(color); |
| 544 | gluTessBeginPolygon(tess, NULL ); |
| 545 | for (int j = 0; j < p->numlines; j++) |
| 546 | { |
| 547 | gluTessBeginContour(tess); |
| 548 | for (int i = 0; i < p->line[j].numpoints; i++) |
| 549 | { |
| 550 | // create temp array and place |
| 551 | GLdouble* dbls = new GLdouble[5]; |
| 552 | pointers.push_back(dbls); |
| 553 | dbls[0] = p->line[j].point[i].x; |
| 554 | dbls[1] = p->line[j].point[i].y; |
| 555 | dbls[2] = 0.0; |
| 556 | dbls[3] = texWidth; |
| 557 | dbls[4] = texHeight; |
| 558 | gluTessVertex(tess, dbls, dbls); |
| 559 | } |
| 560 | gluTessEndContour(tess); |
| 561 | |
| 562 | } |
| 563 | gluTessEndPolygon(tess); |
| 564 | |
| 565 | // destroy temp arrays |
| 566 | for (std::vector<GLdouble*>::iterator iter = pointers.begin(); iter |
| 567 | != pointers.end(); iter++) |
| 568 | { |
| 569 | delete[] *iter; |
| 570 | } |
| 571 | |
| 572 | glBindTexture(GL_TEXTURE_2D, 0); // Select Our Texture |
| 573 | |
| 574 | if (outlinecolor != NULL && MS_VALID_COLOR(*outlinecolor) && outlinewidth > 0) |
| 575 | { |
| 576 | renderPolyline(p, outlinecolor, outlinewidth, 0, NULL, lineCap, |
| 577 | joinStyle); |
| 578 | } |
| 579 | } |
| 580 | |
| 581 | void OglRenderer::renderGlyphs(double x, double y, colorObj *color, |
no test coverage detected