Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML line drawing method produces odd results...  (Read 2333 times)

0 Members and 1 Guest are viewing this topic.

Pixel_Outlaw

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
SFML line drawing method produces odd results...
« on: December 31, 2010, 09:45:42 pm »
I've noticed that drawing angular lines in SFML often produces lines of inconsistent width. Shown below, some of the lines have odd double pixel thick areas which occur during certain angles. These lines are drawn with a 1.0 thickness value.


nulloid

  • Full Member
  • ***
  • Posts: 134
    • View Profile
SFML line drawing method produces odd results...
« Reply #1 on: December 31, 2010, 10:32:32 pm »
There is no problem with it, as I see. Lines are very thin rectangles in SFML. Turn on antialias or use ImageSmooth.
(If I'm wrong, pls, correct me :))

Pixel_Outlaw

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
SFML line drawing method produces odd results...
« Reply #2 on: December 31, 2010, 11:45:36 pm »
Ah OK, that explains how lines can have a width component. If they are indeed treated as rotated rectangles that would explain the odd thick sections. I may have to find a workaround for proper 1 pixel lines it seems. I'm going to get around to OpenGL more but getting a handle on SFML seems to be enough right now. Thanks for the clarification.

nulloid

  • Full Member
  • ***
  • Posts: 134
    • View Profile
SFML line drawing method produces odd results...
« Reply #3 on: January 01, 2011, 11:38:00 pm »
Well, if you want a proper 1-pixel wide line, how'bout implementing a line drawer function with two (integer-based) coordinates, and then overwrite the Image which will be drawed? I believe there are lots of good tutorials about line drawing, because I wanted to write one, and found a lot of them. (I haven't written it, though.)

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
SFML line drawing method produces odd results...
« Reply #4 on: January 02, 2011, 02:27:20 pm »
You can implement a drawable class that uses opengl to draw a proper line. Should take maximum 5 min.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio