2

If I want to draw lines, pure lines with GL_LINES primitive with only two positions.

Should I turn ON the glPolygonMode to GL_LINE too ? Or set the drawing primitive to GL_LINES is enough ?

EDIT: I use modern OpenGL technics

4
  • If you have just 2 points then I recommend to use the GL_LINES primitive. For any triangle primitive you would need at least 3 vertices (points). Commented Aug 17, 2020 at 14:01
  • Yes I know that, I wanted to know If I should change the glPolygonMode() state too. Commented Aug 17, 2020 at 14:02
  • 1
    The polygon mode doesn't affect line and point primitives. It just changes the rasterization of polygons (triangles) - see glPolygonMode Commented Aug 17, 2020 at 14:03
  • Ok thank you ! I got some troubles to have my lines on screen, I can discard this. Commented Aug 17, 2020 at 14:05

1 Answer 1

2

It is useless and superfluous to change the polygon mode, when rendering line primitives. As the name suggests, polygon mode only affects polygons (triangle primitives), but it doesn't affect line and point primitives. glPolygonMode just controls the rasterization of polygons (triangles).

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, as well as culling mode. Thank you for the refresh, I was unsure because I never draw lines directly. (My bug was the VBO...)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.