Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 10 of 12

Thread: Smooth/think line rasterization in 3.2 core profile

Hybrid View

  1. #1
    Intern Newbie
    Join Date
    Jul 2009
    Posts
    42

    Smooth/think line rasterization in 3.2 core profile

    Hello

    Of all the deprecated features from 2.0 that I've been able to live with and mostly agree with, I got to say I strongly disagree with the decision to remove glLineWidth > 1.0 + smooth line rasterization from the core profile. Even GLES 2.0 supports this. As a developer of an engineering-like application, this sort of rendering is crucial to my pipeline, and now I've had to sacrifice it to get support for modern shader languages.

    Can someone please point me to an alternative implementation that replaces the old line rendering with EXACT visual similarity to the old stuff?

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,123
    Not what you asked, but you could just use the compatibility profile and exploit this feature, if it is offered by the GPU vendor(s) you're targetting. Possibily as a short-term solution or to compare against while you work out your own implementation.
    Last edited by Dark Photon; 01-02-2014 at 08:48 AM.

  3. #3
    Junior Member Regular Contributor tksuoran's Avatar
    Join Date
    Mar 2008
    Location
    Cambridge, UK
    Posts
    223
    You can do wide lines with geometry shader. I experimented with this a while back - see http://neure.dy.fi/wideline.html

    I did not seek similar quality, but it should be possible to get pretty close. What I wanted back then was round line ends, which I achieved with by calculating distance to line segment in the fragment shader, rendering in multisample, and using alpha to coverage. To get results which are more like old line smooth, you probably would want to use blending instead of alpha to coverage, and calculate distance to line instead of line segment.

    Note that non-multisample wide line rasterization in OpenGL is different, and IMO useless.

  4. #4
    Member Regular Contributor malexander's Avatar
    Join Date
    Aug 2009
    Location
    Ontario
    Posts
    302
    You can still use line widths > 1.0 in the core profile, and render to a multisample render target. That looks pretty decent for 4x multisample and above. The old smooth lines are pretty slow for a relatively large number of lines.

    Edit: Assuming your GPU can handle it -- there are limits to the line thickness, usually topping out at 10.

  5. #5
    Junior Member Regular Contributor tksuoran's Avatar
    Join Date
    Mar 2008
    Location
    Cambridge, UK
    Posts
    223
    Quote Originally Posted by malexander View Post
    You can still use line widths > 1.0 in the core profile
    While you can use wide lines in core profile, they are still deprecated. If you create a context with forward compatibility, wide lines are not supported.

    Remember that forward compatibility should only be used during development, and never in release builds.

  6. #6
    Intern Newbie
    Join Date
    Jul 2009
    Posts
    42
    Quote Originally Posted by tksuoran View Post
    While you can use wide lines in core profile, they are still deprecated. If you create a context with forward compatibility, wide lines are not supported.

    Remember that forward compatibility should only be used during development, and never in release builds.
    Can you elaborate? I'm targeting osx only where I'm assuming 3.2 (and not higher, so I can't use geom shaders). Using compatability prevents me from being able to use shader language 150 isn't that true? Or am I missing something?

    Is there a way to get GL_VERSION to spit out 3.2 without losing legacy features?

  7. #7
    Advanced Member Frequent Contributor arekkusu's Avatar
    Join Date
    Nov 2003
    Posts
    761
    Quote Originally Posted by mlfarrell
    Is there a way to get GL_VERSION to spit out 3.2 without losing legacy features?
    Not on OSX. Legacy (Compatibility) = 2.1, else you get a Core (which is always forward-compatible, so all deprecated features are removed) context, = 3.2, 3.3, or 4.1 depending on the OS version and renderer.

    But you can use geometry shaders in either profile, via EXT_geometry_shader4 in Compatibility, or as a GLSL 150+ feature in Core.

    And, I'll propose that you really don't want to exactly emulate the appearance of GL's lines. If you think you do, spend more time carefully looking at the behavior of wide lines, AA, and line caps across all drivers. For consistency, you're better off rolling your own wide line segments (i.e. with a geometry shader: convert line strip (adjacency) to tri strips; find the line segment perpendicular vector after clip space projection, taking into account the viewport scale.) And then, if you like, you can ensure segments are joined or end caps are beveled better than GL does.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •