Menu

gluTess Procedure

Help
2018-01-18
2018-01-19
  • Aly Douglas

    Aly Douglas - 2018-01-18

    Hi,

    I am having some issues with the gluTess related procedures. We have some existing code that uses the gluTess calls to create the vertices for a series of TGLMesh to represent a complex polygon. This works well and we make use of the DATA version of these calls to pass some information between the callbacks.

    This is all working well under 32-bit but under 64-bit, the call backs are being triggered OK but they contain nonsense data, and the UserData part always returns nil.

    To try and work out what the issue might be, I looked through and attempted to use the GLGLUTesselation.pas. However, I find that under even 32-bit the callbacks are never triggered in your DoTesselation routine. A very simple test I did is shown below.

    procedure test;
    var
      VectorList: TAffineVectorList;
      Mesh: TGLBaseMesh;
    begin
      VectorList := TAffineVectorList.Create;
      VectorList.Add(1, 0, 0);
      VectorList.Add(1, 1, 0);
      VectorList.Add(0, 1, 0);
      VectorList.Add(0, 0, 0);
      VectorList.Add(1, 0, 0);
    
      Mesh := TGLBaseMesh.Create(nil);
    
      DoTesselate(VectorList, Mesh);
    end;
    

    Do you know what might cause the DoTesselation routine to seemingly fail under 32 and 64-bit. And would you have any idea why the gluTess calls are working well under 32-bit but not under 64? Commenting out the tesselation routines allows all other GLScene objects to draw without issue in both 32 and 64.

    Many thanks in advance,

    Aly

     
  • Aly Douglas

    Aly Douglas - 2018-01-18

    Well, they say sharing a problem can help you find a solution!

    In my own code, I had defined the callbacks within the procedure calling the gluTess routines.

    i.e.

    procedure TMyTesselation.Tessellate;
        procedure TessBegin...
        procedure TessVertex... etc.
     var
         tess: PGLUTessellator;
         ....
      begin
          tess := gluNewTess;
          ....
      end;    
    

    Moved the call backs outside the procedure and in to the implementation body and all works fine now in 64-bit.

    However, this doesn't answer why the GLGLUTesselation doesn't appear to work.

     
    • Pavel Vassiliev

      Pavel Vassiliev - 2018-01-19

      Hi Aly,
      Apply the whole code of your test project, may be the reason in uses clause.
      PW

       
  • Jerome.D (BeanzMaster)

    Hi, i've it's due to the difference of adressing between 32 & 64 bit. the compiler outputfor the function DoTesselate should be different, so a register in stackframe it's surely moved or changed.
    For example in assembly for having acces to a class itself under 32bit (windows & linux) the register is EAX is used and for 64 bit it's RCX for windows and for linux 64bit it's RCI.
    Under 64bit the size of pointer is not the same. And if a variable become unaligned or whatever it's cause a bug

     

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.