modelling interference fringes

i was modelling the interference fringes of an experiment. the variation of intensity of the pattern will depend on the cosine of the phase difference. what capabilities are there in opengl so that i can make the pattern look realistic

In OpenGL, you can use from three transformations:Translation, Rotation ,Scaling. You should use from these transformations to move fingers. Computing the mathematics is on to you–OpenGL dosn’t provide some functions to compute the mathematics.

Do you want to show the data in 2d or in 3d?

The math is up to you, opengl does provide the graphical primitives (points, lines, polygons, …) to present your data

i want it in 2D. the math is not the problem. i want to know how the intensity variation can be modelled by suitable shading. the intensity varies as i = 2I(1+cos(theta)). the shading should model this equation. i have seen function glShadeModel() It takes GL_SMOOTH as one of its parameters.But the intensity variation doesnt correspond to the above equation. that is my problem.

i think you could use the ARB_texture_env_dot3 extension. it combines two textures using a dot product on a per-pixel basis.

as we know, if we have two unit vectors a and b with an angle theta between them,

cos(theta) = a dot b.

so you could just construct a texture A with (0,0,1) normals and a texture B with (0, 0, cos(theta)).

be aware that an rgb value of (0,0,0) corresponds to a normal (0,0,-1), as rgb=(0,0,255) corresponds to a normal (0,0,1)