Menu

TGLMesh shademodel smSmooth not working

Help
polyodon
2015-07-02
2015-07-22
  • polyodon

    polyodon - 2015-07-02

    I have a freeform and added a TGLMesh in code as a child (not a meshobject)
    It renders ok but only in Flat mode. The GLSceneViewer.buffer.shademodel has no effect. If I set it to smSmooth the GLMesh is rendered flat.

    Any hint?

     
  • polyodon

    polyodon - 2015-07-03

    Here a demo

    C:\MHH\Delphi\GLScene\Samples\Delphi\Demos\meshes\formula

    if you make the form and the Sceneviewers size bigger you see the trianges rendered Flat.
    you can also set the constant 'cResolution' to like 20 to seen the rasterization better.

    Setting Screenviewer.buffer.shademodel to smFlat or smSmooth has no effect.

    How can I render the meshes "Smooth"???

    Thanks

     
  • polyodon

    polyodon - 2015-07-03

    I found some information about the problem.

    It turned out that for smooth redering to work vertices have to have the appropriate normals. It is not sufficient to call glmesh.CalcNormals(fwCounterClockWise); This will create normals for all three vertices of a face, but for smooth rendering to work each vertex has to have a normal calculated as the average of all the triangles where it is used (also the neighboring triangles) for more imformation google "opengl vertex normals smooth".

     
  • Eric Hardinge

    Eric Hardinge - 2015-07-21

    Hi Inebel and polyodon,
    Would it be possible for you to post a code segment or demonstration for the smoothing procedure you are using for GLMesh. That would be much appreciated ?
    Eric Hardinge.

     
  • Eric Hardinge

    Eric Hardinge - 2015-07-22

    Thank you for your speedy response and for the code sample, which I will spend some time learning how to use.
    Eric Hardinge

     

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.