Page 80 of 91

Re: "Questions that don't deserve their own thread" thread

Posted: Thu Nov 17, 2016 11:01 pm
by parallax7d
Are there specific plans to break it in the works, or just the vague notion that it may one day break?

Re: "Questions that don't deserve their own thread" thread

Posted: Thu Nov 17, 2016 11:55 pm
by slime
0.11's code already breaks it, since 0.11 provides a variety of ImageData formats compared to just 32-bit RGBA in 0.10 and older – plus 0.11's colors are within [0, 1] rather than [0, 255], so the conversion between the internal representation of 32-bit RGBA and the Lua API values is different.

If you want to split work up between threads, a safer option that doesn't involve mutex contention might be to create an ImageData per thread, sized to the subsection of the main ImageData that the thread would have operated on, and then call [wiki]ImageData:paste[/wiki] several times in the main thread after all worker threads have completed their operations.

Also be sure to use [wiki]ImageData:mapPixel[/wiki] rather than ImageData:setPixel, since the former only does a single mutex lock whereas setPixel does a mutex lock per call.

Re: "Questions that don't deserve their own thread" thread

Posted: Fri Nov 18, 2016 1:05 am
by davisdude
slime wrote: plus 0.11's colors are within [0, 1] rather than [0, 255]
Is there any reason for this? I'm just curious: from a design standpoint, what is the motivation behind it?

Re: "Questions that don't deserve their own thread" thread

Posted: Fri Nov 18, 2016 1:55 am
by slime
  • It's more consistent (shader code and Shader:send already uses colors within [0,1] for example)
  • it's less restrictive (love 0.11 will provide other ImageData formats such as 32 bit floating point RGBA, which don't have normalized values, so the 0-255 range makes no sense there)
  • it makes math on colors such as interpolation and combining (e.g. multiplying) easier since you don't have to deal with dividing by 255
  • in a lot of cases it's more natural to write the values (e.g. is halfway between no value and full value 127 or 128 in a 0-255 range? in 0-1 it's just 0.5. What's halfway between no value and half? 1/4 aka 0.25 with 0-1, or ~64 with 0-255 range).

Re: "Questions that don't deserve their own thread" thread

Posted: Fri Nov 18, 2016 2:19 am
by Le_juiceBOX
Hey, I was wondering if it is possible to open 2 or more windows using love.

Thanks ^^ .

Re: "Questions that don't deserve their own thread" thread

Posted: Fri Nov 18, 2016 2:23 am
by slime
love only supports a single window, although you can close and re-open it multiple times!

Re: "Questions that don't deserve their own thread" thread

Posted: Fri Nov 18, 2016 12:29 pm
by Le_juiceBOX
slime wrote:love only supports a single window, although you can close and re-open it multiple times!
Thanks!


Is there a way to open a second exe or love file inside the game?

Re: "Questions that don't deserve their own thread" thread

Posted: Fri Nov 18, 2016 5:46 pm
by Positive07
[manual]os.execute[/manual] or [manual]io.popen[/manual] should do the trick, be careful with Operating System differences though. For comunications you could use one of the networking libraries and you could simulate that the windows come from a single program. I'm not sure if LÖVE won't try to launch a console when you execute the command in Windows... you should try it though

Re: "Questions that don't deserve their own thread" thread

Posted: Sat Nov 19, 2016 1:48 am
by Le_juiceBOX
Positive07 wrote:[manual]os.execute[/manual] or [manual]io.popen[/manual] should do the trick, be careful with Operating System differences though. For comunications you could use one of the networking libraries and you could simulate that the windows come from a single program. I'm not sure if LÖVE won't try to launch a console when you execute the command in Windows... you should try it though


Thanks! this helped a lot :awesome:

Re: "Questions that don't deserve their own thread" thread

Posted: Sat Nov 19, 2016 11:36 pm
by Jasoco
The question is, are you trying to open two windows in the same game? Because Löve can't currently do that due to limitations. Or are you trying to open two instances of Löve and a game at once? Because that can be done depending on the OS. On macOS I can open multiple instances with the Terminal. The command line on any OS should allow it.