Menu

Strange TGLMeshLines display

Help
Liang Rong
2016-05-05
2016-05-09
  • Liang Rong

    Liang Rong - 2016-05-05

    Hello

    I try to draw city roads. Using TGLLines is result fine (see attachment) but since the speed is slow on zooming/rotation, I switch to TMeshLines. But then I have very strange result by diffeent linewidth (see attachment),

    I have following codes for TMeshLines as:

      function CreateNewMeshLineItem(OwnerPlane:TGLPlane; var MeshLine:TMeshLines3D):TLineItem;
      var
        FGLMeshLines: TGLMeshLines;
      begin
        // we will have only one Meshline for one plane to hold all the roads
        // and each road is a one TLineItem
        if  FGLMeshLines=nil then
        begin
          FGLMeshLines :=TMeshLines(CityPlane.AddNewChild(TMeshLines));
         // do not forget EndUpdate at finishing loading roads
         FGLMeshLines.BeginUpdate;
          FGLMeshLines.NoZWrite := True;
          FGLMeshLines.ShowNodes := False; 
          FGLMeshLines.Material.FrontProperties.Emission.Color :=clrGold;
        end;
    
        // we need a new lineitem for a new road,
        Result :=FGLMeshLines.Lines.Add;
        Result.Name :='Road'+IntToStr(FGLMeshLines.Lines.Count);
        // default
        Result.SplineMode :=lsmLines;
        Result.Division := 1;
        Result.TextureCorrection := False;
        Result.BreakAngle := -1;
        Result.TextureLength := 0.1;
        Result.Width :=1;
        Result.Nodes.Clear;
      end;
    

    Is there any setting I have missed, who will make TMeshlines looked as normal lines?

    Thanks.

     
  • Liang Rong

    Liang Rong - 2016-05-05

    Here is the attachment for using TGLLine

     

    Last edit: Liang Rong 2016-05-05
  • Liang Rong

    Liang Rong - 2016-05-05

    using Meshlines

     
  • Liang Rong

    Liang Rong - 2016-05-05

    TGLMeshLines with a different linewidth

     
  • Liang Rong

    Liang Rong - 2016-05-07

    Hello

    Here in attachment is the code to demo. Please select the 'road.mif" file in attachment, who contains the road data in city.

    by default, we will use the TMeshline with linewidth 0.1, and after you uncheck the "use TMeshline", TGLLines will be used, and then you can compare the result.

    Thanks.

     
  • Liang Rong

    Liang Rong - 2016-05-09

    Hi

    Sorry I have forgotten to remove the Eurekalog units, which is used to catch exceptions.

    So I update the source and upload it again.

    This "road.mif" is a high-resoltion mapinfo map of city Shanghai, so at the road crossing, and road turns, the coordinates may be the same, while in a large scale, the coordinates reflect the actual longtitude and latitude of each road segments, which can be see from the display using TGLLine.

     
  • Liang Rong

    Liang Rong - 2016-05-09

    Hi

    Sorry I have forgotten to remove the Eurekalog units, which is used to catch exceptions.

    So I update the source and upload it again.

    This "road.mif" is a high-resoltion mapinfo map of city Shanghai, so at the road crossing, and road turns, the coordinates may be the same, while in a large scale, the coordinates reflect the actual longtitude and latitude of each road segments, which can be see from the display using TGLLine.

     
  • Liang Rong

    Liang Rong - 2016-05-09

    Hello

    I am really sorry, that the source code is not clean enough.

    Now I checked line by line, and removed all other third-party component and debug utilities.

    The mif file is loaded by clicking the button, and then an file open dialog will come out to select this mif file, who should be in the source code folder not in the bin folder.

    In case of any other problem, please feel free to contact me.

     
  • Dmitry

    Dmitry - 2017-02-07

    Did you solve the problem?

     

    Last edit: Dmitry 2017-02-07

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.