'How to make objects transparent in OpenTK

I'm using OpenTK and C#, I have defined a plane in 3D space as follows:

GL.Begin(BeginMode.Quads);
GL.Color3(Color.Magenta);
GL.Vertex3(-100.0f, -25.0f, -150.0f);
GL.Vertex3(-100.0f, -25.0f,  150.0f);
GL.Vertex3( 200.0f, -25.0f,  100.0f);
GL.Vertex3( 200.0f, -25.0f, -100.0f);
GL.End();

Can anyone please help me to make the plane transparent?



Solution 1:[1]

Finally I found solution of my question:

GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.One);
GL.Enable(EnableCap.Blend);

//Definition of Plane
GL.Begin(BeginMode.Quads);
GL.Color4(0, 0.2, 1, 0.5);
GL.Vertex3(-100.0f, -25.0f, -150.0f);
GL.Vertex3(-100.0f, -25.0f,  150.0f);
GL.Vertex3( 200.0f, -25.0f,  100.0f);
GL.Vertex3( 200.0f, -25.0f, -100.0f);
GL.End();

GL.Disable(EnableCap.Blend);

Solution 2:[2]

In computing, Transparency effects are fained using color blending.For The special case of transprency, we talk about Àlpha Blending`

For transparency the blending factor is usualy stored in the 4th component of the colour (the A in RGBA) which stands for alpha. So you have to set all your colors with it.

example for half transparent blue (like glass):

GL.Color4(0,0,1,0.5f);

In OpenGL, blending have to be activated with the following command, which enable a supplementary stage on the rendering pipeline.

GL.Enable( EnableCap.Blend );

Then, because blending could be used to mix colors for other purpose than transparency, you have to specify the blending function to use. Here is the common function for transparency:

GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);

http://www.opentk.com/doc/chapter/2/opengl/fragment-ops/blending

Solution 3:[3]

Simply use GL.Color4 instead of GL.Color3. The 4th value will be the alpha

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 harishli2020
Solution 2 j-p
Solution 3 Vengarioth