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?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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".
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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?
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
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".
See: https://sourceforge.net/p/glscene/discussion/93606/thread/4289164a/
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.
I have now added a code sample: https://sourceforge.net/p/glscene/discussion/93606/thread/4289164a/
Thank you for your speedy response and for the code sample, which I will spend some time learning how to use.
Eric Hardinge