I have the following code to set up for some 2D drawing using OpenTK. I originally wrote it without any lighting considerations, but later added the lighting block. This version of the code uses GL.Disable(EnableCap.Lighting);
to disable the lighting and show the rendering the way it looked before I added lighting.
GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.TextureEnvMode, (float)TextureEnvMode.Modulate);
GL.Enable(EnableCap.Blend);
GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
GL.Disable(EnableCap.PolygonSmooth);
GL.Enable(texCap);
GL.Disable(EnableCap.DepthTest);
float d1=(float)Math.Cos(Counter.FrameCounter.CurrentValue / 10.0f);
float d2=(float)Math.Sin(Counter.FrameCounter.CurrentValue / 10.0f);
GL.Light(LightName.Light0, LightParameter.Position, new float[] { 100.0f, 100.0f, 50.5f, 1.0f});
GL.Light(LightName.Light0, LightParameter.SpotCutoff, new float[] { 30.0f });
GL.Light(LightName.Light0, LightParameter.SpotDirection, new float[] { d1, d2, -0.5f });
GL.Light(LightName.Light0, LightParameter.SpotExponent, new float[] { 2.0f });
GL.Light(LightName.Light0, LightParameter.Diffuse, new float[] { 1.0f, 0.0f, 0.0f, 1.0f });
GL.Light(LightName.Light1, LightParameter.Position, new float[] { 300.0f, 400.0f, 150.5f, 1.0f});
GL.Light(LightName.Light1, LightParameter.Diffuse, new float[] { 1.0f, 1.0f, 1.0f, 1.0f });
GL.Disable(EnableCap.Lighting);
GL.Enable(EnableCap.Light0);
GL.Enable(EnableCap.Light1);
GL.Disable(EnableCap.Dither);
GL.BindTexture(texTarget, texture.Texture);
GL.Begin(BeginMode.Quads);
That renders like this:
After switching lighting on (GL.Enable(EnableCap.Lighting);
) the translucency (blending?) seems to have been disabled. How to I keep both features active? (Note that in addition to the translucent blue message appearing opaque white, the background in the first image contains a graphic equalizer, which is also no longer visible in the second image because it was behind a translucent layer.)