Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4560330
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T17:54:56+00:00 2026-05-21T17:54:56+00:00

When you draw a line in OpenGL, glLineWidth creates a fixed-size line, regardless how

  • 0

When you draw a line in OpenGL, glLineWidth creates a fixed-size line, regardless how close the line is to you.

I wanted to draw a line that will appear bigger when it’s close. Now, I understand that if I use a rectangle to achieve this effect, it will look a bit pixelated once the polygon is far enough.

What I’ve previously done is to draw a normal GL_LINE up to the point where the line would get bigger than the pixel size, and then continue with a rectangle from that point. However, it’s not as fast as just chucking everything down to a vertex array or VBO, as it had to be recalculated every frame.

What other methods are available? Or am I stuck with this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T17:54:56+00:00Added an answer on May 21, 2026 at 5:54 pm

    I like to use a gradated texture like this to draw lines:

    enter image description here

    This is really the alpha of my texture. So you have a fully opaque center fading to fully transparent at the edges. Then you can draw your line using a rectangle with points:

    (x1,y1,0,0), (x2,y1,1,0), (x1,y2,0,1), (x2,y2,1,1)

    where the last two entries in each tuple are u and v of the texture. It ends up looking very smooth. You can even string together lots of very small rectangles to make curvy lines.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a line that I draw in a window and I let the
What is the best way to draw a variable width line without using glLineWidth?
To draw a dotted line in OpenGL I can use glLineStipple, but how do
In my OpenGL app, it won't let me draw a line greater then ten
I need to draw a smooth line in OpenGL and here is what I
I draw lots of quadratic Bézier curves in my OpenGL program. Right now, the
Where do you draw the line to stop making abstractions and to start writing
How can i draw a dotted line in .NET/WinForms/GDI+? Pen p = new Pen
How do you draw a custom button next to the minimize, maximize and close
What are ways to draw animations in C++? GDI+? OpenGL? Would you recommend a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.