Requesting 1.0.0 instead of 0.10.0

General discussion about LÖVE, Lua, game development, puns, and unicorns.
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: Requesting 1.0.0 instead of 0.10.0

Post by bobbyjones »

I think the current graphics api style is the most new user friendly. I don't think switching it up will make it anymore nice. Especially considering this is a framework that is used by a ton of noobs.
User avatar
Murii
Party member
Posts: 216
Joined: Fri Jul 05, 2013 9:58 am
Location: Arad, Romania
Contact:

Re: Requesting 1.0.0 instead of 0.10.0

Post by Murii »

zorg wrote:
bobbyjones wrote:Love can't become 1.0 until is has HTTPS and microphone support lol.
And an expanded (better) audio API in general :3
You really dont want to mess around with audio and openal!
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Requesting 1.0.0 instead of 0.10.0

Post by zorg »

Murii wrote:
zorg wrote:
bobbyjones wrote:Love can't become 1.0 until is has HTTPS and microphone support lol.
And an expanded (better) audio API in general :3
You really dont want to mess around with audio and openal!
Believe me, i intend to! :3
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
adnzzzzZ
Party member
Posts: 305
Joined: Sun Dec 26, 2010 11:04 pm
Location: Porto Alegre, Brazil

Re: Requesting 1.0.0 instead of 0.10.0

Post by adnzzzzZ »

kikito wrote:
  • The graphics library will be separated. Object creation (like newCanvas, newQuad), window functions (like setCaption) and system stuff (like getRendererInfo) will remain in love.graphics. Drawing (line, circle) as well as state (push, pop, etc) will be moved to the Canvas object. So you will do canvas:circle(...) instead of love.graphics.circle(...).
  • Related to the previous one, love.draw will receive the "default canvas" as a parameter, just like love.update receives dt. The default canvas will be "special" in the sense that the LÖVE loop is the one which maintains it, and also will expand/contract if the window size changes.
What are the reasons for these changes? What do they achieve that can't be done now?
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Requesting 1.0.0 instead of 0.10.0

Post by Davidobot »

slime, I have a question: I remember you saying that the new Mesh Attributes will be able to solve the following problem of texture distortion (AKA the resulting image not having perspective correctness), when drawing "textured polygons":
Image

How would that look in code? Also, would it be theoretically possible to use the attribute system in order to have a sort of depth-buffer?
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Requesting 1.0.0 instead of 0.10.0

Post by kikito »

adnzzzzZ wrote:What are the reasons for these changes? What do they achieve that can't be done now?
Main reason is removing global state. The fact that LÖVE has a "global current canvas" makes all drawing-related code not pure. Yes, this means that all drawing functions would get a 'canvas' param. That's worth it in my mind. "update" functions already get a "dt" parameter and that's ok. Pure functions are always prefearable to non-pure ones (Don't take my word for that).

I also suspect that the LÖVE internal code would get simplified if it didn't have to keep track of the global state. At the very least you would remove set/getCanvas.

The interface would also look similar to what you find in other environments like javascript and the browser, where the "canvas" abstraction is the one used to draw.

When I proposed this change I didn't know that OpenGL needed a "current canvas" for performance reasons though.
When I write def I mean function.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Requesting 1.0.0 instead of 0.10.0

Post by bartbes »

kikito wrote: I also suspect that the LÖVE internal code would get simplified if it didn't have to keep track of the global state. At the very least you would remove set/getCanvas.
On the contrary, it probably requires more work since OpenGL is very stateful itself.

Although I would like a more explicit API, it's very easy to make things very expensive without noticing. If you keep having to change (practically) all state between two alternating calls, the code itself may hide this.
User avatar
slime
Solid Snayke
Posts: 3133
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Requesting 1.0.0 instead of 0.10.0

Post by slime »

kikito wrote:When I proposed this change I didn't know that OpenGL needed a "current canvas" for performance reasons though.
bartbes wrote:On the contrary, it probably requires more work since OpenGL is very stateful itself.
In this case it's not just OpenGL that has this state – GPUs themselves only operate on one (set of) render targets / Canvases at a time, and switching that set to a different one can be very expensive in the hardware. That will remain true even if DirectX 12 or Vulkan or Metal is used.

Those newer APIs do have ways to schedule different lists of commands at once to be executed for different sets of render targets, by having 'command list' / 'draw pass' objects you can create and pass around. But the order that those command lists will be executed in still needs to be determined at some point, so exposing that capability would make the API more complicated.
User avatar
Linkpy
Party member
Posts: 102
Joined: Fri Aug 29, 2014 6:05 pm
Location: France
Contact:

Re: Requesting 1.0.0 instead of 0.10.0

Post by Linkpy »

slime wrote:
pgimeno wrote:

Code: Select all

function Canvas:circle(...)
  love.graphics.setCanvas(self)
  love.graphics.circle(...)
end
Or, make a pseudo-canvas :

Code: Select all

-- In a a file :
local GlobalCanvas = Object:new ()

function GlobalCanvas:circle (...)
     love.graphics.circle (...)
end

function love.graphics.getCanvas ()
    -- Code for checking if a real canvas is setted
    -- If no canvas is setted :
    return GlobalCanvas
end
This method allow the two usage :
  1. The current usage, so with love.graphics.* functions ;
  2. The "new" usage, so with canvas:* functions ;
And, for the problem of efficiency of ".setCanvas" :

Code: Select all

-- In a file lol

-- A tracking variable
local currentCanvas = nil

function love.graphics.setCanvas(canvas)
    if canvas == currentCanvas then
        return
    end
    -- Set the current Canvas.
end

-- In another file

function Canvas:circle (...)
    love.graphics.setCanvas (self)
    love.graphics.circle (...)
end
With this, we set the canvas only once, even with multiple call of .setCanvas. ( BTW, I think this check is already done internally, but I add it anyway :crazy: )
Founder of NeoShadow Studio. Currently working on the project "Sirami".
github / linkpy
Post Reply

Who is online

Users browsing this forum: No registered users and 260 guests