How to activate the OpenGl Spline interpolation ?

Hi all,

I'm currently creating triangles with this methods :
Graphic3d_Array1OfVertexNC and Aspect_Array1OfEdge.

Then I draw my array of triangles like this :

Handle(Graphic3d_AspectFillArea3d) myFillAspect = new Graphic3d_AspectFillArea3d();
Handle( Graphic3d_Group ) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
Graphic3d_MaterialAspect mat = myFillAspect->FrontMaterial();

//Material Aspect personnalisation


TheGroup->TriangleSet(verticesNC, mesEdges);

This is good working but OpenGl use a linear interpolation between vertices. You can see the capture.

For some triangles, the renderer is not good, I would like a more smooth rendering.

How can I activate a spline interpolation between vertices instead of a linear interpolation ?

Many thanks for your help.


Thomas Paviot's picture

Hi Mathieu,

The attached screenshot is beautiful! It looks like a supernova blow. What is it exactly?

I don't know if OpenGL can perform non-linear (quadratic, spline etc.) interpolation of colours between vertices. I think that the OpenGL Shading Language (GLSL) could suit your needs. Unfortunately, OCC implements a quite outdated version of OpenGL, and GLSL is not available.

However, I think it should not be that hard to implement GLSL support in OpenCascade.

Best Regards,


Mathieu's picture


Thank you for your answer Thomas. It helps me a lot.
This is not a supernova blow, it's just the temperature on a surface :-)

I only have one problem to customize the material renderer when I use a Handle(Graphic3d_ArrayOfTriangles) aTrianglesArray object.

When I use this two objects :
static Graphic3d_Array1OfVertexNC verticesNC(1, myMesh->GetElementsNber()*3);
static Aspect_Array1OfEdge mesEdges(1, myMesh->GetElementsNber()*3);
I don't have problem.

It seems that the rendering is different between this two way to do but I don't know where I can find documentation...