Problems with the new line drawing system in 0.8

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Arckanum
Prole
Posts: 5
Joined: Mon May 07, 2012 10:51 pm

Problems with the new line drawing system in 0.8

Post by Arckanum »

I currently have some issues with the new line drawing system in 0.8. When i draw into a canvas with LineStyle("smooth") the lines just appear squashed. I dont know how to explain it, so i'm showing you some comparison images with rough and smooth setting of a coordinate system (nothing else is changed). My main problem with rough is that it doesnt really look well if you zoom out quite a bit. The edges are too sharp.

Code is really basic so far. Just drawing some lines. Scaling,fontsize and moving across the screen is managed elsewhere (isnt my problem anyway).

Code: Select all

GLS = 0.1

function love.draw()
	love.graphics.setColor(255,255,255)
        love.graphics.scale( 1.0, 1.0 )
	love.graphics.draw(fb,0,0)
end

function love.load()
	love.graphics.setBackgroundColor(255, 255, 255)
	love.graphics.setMode(600, 600, false, true, 0)
	fb = love.graphics.newCanvas( )
	fb:setWrap( "clamp", "clamp" )
	InitFB()
end

function InitFB()
	fb:clear()
	love.graphics.setCanvas(fb)
	love.graphics.translate( 300+Dx, 300+Dy )
	love.graphics.scale( scale, scale )
	love.graphics.setColor(0,0,0)
	love.graphics.setLineStyle( "rough" )

	love.graphics.setLineWidth(0.04)
	love.graphics.line(0,0,10000,0)
	love.graphics.line(0,0,0,10000)
	love.graphics.line(0,0,0,-10000)
	love.graphics.line(0,0,-10000,0)
	love.graphics.setLineWidth(0.04)
	Fontscaler = Fontsize/Fontfactor
	for i=1,100	do
		--x
		love.graphics.line(i,-GLS,i,GLS)
		love.graphics.print(i, i, 0.2, 0, Fontscaler , Fontscaler )
		love.graphics.line(-i,-GLS,-i,GLS)
		love.graphics.print("-"..i, -i, -1, 0, Fontscaler , Fontscaler )
		--//x
		--y
		love.graphics.line(-GLS,i,GLS,i)
		love.graphics.line(-GLS,-i,GLS,-i)
		love.graphics.print("-"..i, -1, i, 0, Fontscaler , Fontscaler )
		love.graphics.print(i, 0.1, -i-0, 0, Fontscaler , Fontscaler )
		--//y
	end
Please help me with the issue,

Arckanum
Attachments
Smooth.jpg
Smooth.jpg (31.48 KiB) Viewed 4427 times
Rough.jpg
Rough.jpg (15.62 KiB) Viewed 4427 times
Last edited by Arckanum on Mon May 07, 2012 11:14 pm, edited 1 time in total.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Problems with the new line drawing system in 0.8

Post by kikito »

How about this:

Code: Select all

if zoom >= far_away then
  mode = "smooth"
else
  mode ="rough"
end
When I write def I mean function.
Arckanum
Prole
Posts: 5
Joined: Mon May 07, 2012 10:51 pm

Re: Problems with the new line drawing system in 0.8

Post by Arckanum »

kikito wrote:How about this:

Code: Select all

if zoom >= far_away then
  mode = "smooth"
else
  mode ="rough"
end
Doesnt really work. Smooth still looks like crap the very moment rough is already cutting critical pixels. Look at this sine curve. The first image is with rough mode and the second is zoomed out similar with smooth mode. Really looks bugged for me.
Attachments
sin2.jpg
sin2.jpg (41.43 KiB) Viewed 4417 times
Sin.jpg
Sin.jpg (15.67 KiB) Viewed 4417 times
User avatar
slime
Solid Snayke
Posts: 3166
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Problems with the new line drawing system in 0.8

Post by slime »

Make sure your blend mode is set to "premultiplied" when you draw the canvas to the screen, if it isn't already.
Arckanum
Prole
Posts: 5
Joined: Mon May 07, 2012 10:51 pm

Re: Problems with the new line drawing system in 0.8

Post by Arckanum »

slime wrote:Make sure your blend mode is set to "premultiplied" when you draw the canvas to the screen, if it isn't already.
This actually helped quite a lot. I'm working on a very(!) small scale. I guess this is the problem. It always worked with 0.7.2. Rescaling the whole thing should help quite a bit. Anyway thanks.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Problems with the new line drawing system in 0.8

Post by Robin »

I had exactly the same issue. They told me to use larger line pieces. That means a solid rewrite for me, due to how the game works.
Help us help you: attach a .love.
Arckanum
Prole
Posts: 5
Joined: Mon May 07, 2012 10:51 pm

Re: Problems with the new line drawing system in 0.8

Post by Arckanum »

Robin wrote:I had exactly the same issue. They told me to use larger line pieces. That means a solid rewrite for me, due to how the game works.
Yeah i'm also working on it, but for the meantime i'm still using 0.7.2.. Perhaps they work on the line system and it's fixed in the next version.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Problems with the new line drawing system in 0.8

Post by Robin »

Arckanum wrote:Perhaps they work on the line system and it's fixed in the next version.
Don't hold your breath for it.
Help us help you: attach a .love.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Problems with the new line drawing system in 0.8

Post by bartbes »

Except it's not broken (afaik). You guys depended on a bug that has now been fixed.
Arckanum
Prole
Posts: 5
Joined: Mon May 07, 2012 10:51 pm

Re: Problems with the new line drawing system in 0.8

Post by Arckanum »

bartbes wrote:Except it's not broken (afaik). You guys depended on a bug that has now been fixed.
The main question for me is why it works with rough mode though.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 4 guests