Creating a Post-processor

Creating a Post-processor

I am creating a post-processor for a finite element program but I didn´t get a good quality of the images. I used the sequence of ideas below to create an image representing the specific result.

1) Creating the pallete of colors;

2) Creating a list where I use the fglBegin(GL_POLYGON), fglColor3f, and fglVertex2f functions to create the mesh´s elements and define a color for each element´s vertex.

3) Calling the list to create the image.

Inside the elements I didn´t get a good smoothing process between colors defined in each vertex. What I could do to improve the quality inside elements.

Thank you for your support.

Carlos A Santos. 




Download PrintScreen.png151.15 KB
3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I think that is due to the fact that the mesh is very course in relation to the variation in the colours over the nodes. 

Generally the fill algorithm will be (for a quad) something like, you start from the lowest corner  and advance upward one pixed at a time drawing a horizontal scan line. Where that line crosses the edges of the quad you interpolate linearly along that edge to get an intensity at each end of the horizontal scan line. You then interpolate linearly along that scan line to get an intensity for each pixel on the line.

You only have linear interpolation and every time the scan line crosses a  node there is a step in the interpolation.

If you increase the mesh density the colour index smoothness change will improve.




For a quad, OpenGL seems to draw two triangles so you can get two different results depending on which corner you start at. I have seen code that detects which diagonal of the quad sees greater variation and sets the starting point of the quad accordingly. This can result in readily perceptible improvement.

Leave a Comment

Please sign in to add a comment. Not a member? Join today