Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 2217

Summary: Polygons incorrectly filled in OpenGL
Product: VCL TeeChart Reporter: yeray alonso <yeray>
Component: OpenGL 3DAssignee: Steema Issue Manager <issuemanager>
Status: CONFIRMED ---    
Severity: enhancement CC: jeff
Priority: ---    
Version: 26.181203   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Chart Series: --- Delphi / C++ Builder RAD IDE Version:

Description yeray alonso 2019-07-29 05:24:47 EDT
Here a simple example:

uses TeCanvas, TeeGLCanvas;

procedure TForm1.FormCreate(Sender: TObject);
begin
  ComboBox1.Items.Add('OpenGL');
  ComboBox1.Items.Add('GDIPlus');
  ComboBox1.ItemIndex:=0;
  ComboBox1Change(Sender);
end;

procedure TForm1.ComboBox1Change(Sender: TObject);
begin
  case ComboBox1.ItemIndex of
    0: Draw3D1.Canvas:=TGLCanvas.Create;
    1: Draw3D1.Canvas:=TGDIPlusCanvas.Create;
  end;
end;

procedure TForm1.Draw3D1Paint(Sender: TObject; const ARect: TRect);
var c: TCanvas3D;
    tx: array[0..8] of TPoint;
begin
  c:=Draw3D1.Canvas;

  c.Pen.Style := psSolid;
  c.Pen.Color := clBlack;
  c.Pen.Width := 2;
  c.Brush.Color := clLime;
  c.Brush.Style := bsSolid;

  tx[0] := Point(100,200);
  tx[1] := Point(100,500);
  tx[2] := Point(500,500);
  tx[3] := Point(500,100);
  tx[4] := Point(400,100);
  tx[5] := Point(400,400);
  tx[6] := Point(200,400);
  tx[7] := Point(200,200);
  tx[8] := Point(100,200);

  c.PolygonWithZ(tx, 8);
end;
Comment 1 jeff@nuhertz.com 2019-08-02 15:09:54 EDT
The bug can be worked around for polygons that employ only vertical horizontal and 45 deg lines by painting the complex polygon using a series of MoveTo3D, LineTo3D, or LineWithZ commands.  I have not tried it with other line angles.  You have to zoom in to 10 (100 being no zoom) to get adequate resolution needed to avoid spaces between the lines.  Just set the zoom level back when done.

A more permanent and robust fix might be a recursive dot paint algorithm, but the above work-around is adequate for my current needs.