eugene.chepurnykh's picture

Troubles with lines without GL.Disable(EnableCap.Texture2D)

The trouble is very simple. I'm working with textures and in init function call
OpenGLHelper.EnabledTexture2D
later, in renderer I must call

<b>                OpenGLHelper.DisableTexture2D();</b>
                // Сursor line
                GL.Color3(Color.Black);
                GL.Begin(BeginMode.Lines);
                GL.Vertex2(timeline.TracksAreaBounds.Left, timeline.CursorOffset);
                GL.Vertex2(timeline.TracksAreaBounds.Width, timeline.CursorOffset);
                GL.End();
 
                <b>OpenGLHelper.EnableTexture2D();</b>

Without these bold lines I have unpredictable behaviour. Sometimes alpha near 255, sometimes color of lines unexpected.

Does anybody have this kind of troubles?

Any suggestions will be appreciate.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kanato's picture

If you don't disable texturing, then the lines will be textured. Since you aren't specifying a texture coordinate, OpenGL is simply using the last texture coordinate for both points in the line, which will give the entire line the color of whatever texel is addressed by the last call to GL.TexCoord. If you don't want your lines textured, then you need to disable texturing.