Results 1 to 5 of 5

Thread: Is setting line smoothing retrospective?

  1. #1
    Member Newbie
    Join Date
    Apr 2009
    Posts
    35

    Is setting line smoothing retrospective?

    I am drawing a line without enabling line smoothing, then I enable line smoothing with:

    Code :
    glEnable(GL_LINE_SMOOTH);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);

    and to my surprise the first line is smoothed as well (which is not what I want).

    So why is this seemingly retrospective and how can I draw one line not smoothed and then another one with smoothing applied? I have tried glFlush() between drawing the lines but it didn't help.

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Is setting line smoothing retrospective?

    Do you disable GL_LINE_SMOOTH before drawing the first line ?
    Nothing to do at all with glFlush()

  3. #3
    Member Newbie
    Join Date
    Apr 2009
    Posts
    35

    Re: Is setting line smoothing retrospective?

    OK, I do now and it is working, but why do I need to disable line smoothing BEFORE I draw the first line? Does that mean it is enabled by default?

  4. #4
    Newbie OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,789

    Re: Is setting line smoothing retrospective?

    State carries over from frame to frame. So what you're doing is effectively this:

    frame 1:
    - clear screen
    - draw line 1 // line smoothing is disabled
    - enable line smoothing
    - draw line 2 // line smoothing is enabled

    frame 2 and above:
    - clear screen
    - draw line 1 // line smoothing is still enabled!!!
    - enable line smoothing
    - draw line 2 // line smoothing is enabled

  5. #5
    Member Newbie
    Join Date
    Apr 2009
    Posts
    35

    Re: Is setting line smoothing retrospective?

    Yes, that is correct indeed! Thanks to you both

Similar Threads

  1. Line smoothing
    By muthuveera in forum OpenGL: Linux
    Replies: 0
    Last Post: 02-27-2015, 06:13 AM
  2. Replies: 5
    Last Post: 05-18-2014, 04:22 PM
  3. Support for line smoothing in float fbo
    By tellaman in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 11-20-2008, 06:25 AM
  4. glHint with line, point, polygon smoothing hints
    By cemo in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 07-12-2008, 05:00 AM
  5. polygon offset and line smoothing
    By remdul in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 10-22-2005, 06:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean