Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Set LineWith using Qt5 on Windows with OpenGL
Qt 6.12 LTS is out! See what's new in the release blog

Set LineWith using Qt5 on Windows with OpenGL

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 2.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hi,

    today I was successful drawing lines with OpenGL using Qt5 on Windows. However I was not able to change the OpenGL line width.

    Minimum example:
    Started with the project gui/openglwindow. In the file main.cpp I changed the command to draw the triangle from
    glDrawArrays(GL_TRIANGLES, 0, 3);
    to
    glDrawArrays(GL_LINE_STRIP, 0, 3);
    which results in two lines being drawn that change colors between the vertex points.

    Question: How do I change the width of the lines being drawn? Is there a simple solution using Qt or OpenGL methods (glLineWidth does not seem to work but gives no error either)? Can shaders be employed? If so, how? Does the behaviour differ if desktop OpenGL is used instead of OpenGL ES with the ANGLE library?

    Thanks in advance for your help.

    Best regards,
    Christian

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt
    • Unsolved