mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Added MRT support to canvases via love.graphics.setCanvases(c1, c2, ...), and an 'effects' callback function in shaders.
- Simultanious rendering to multiple canvases requires all canvases to be the same size (limitation of pre-GL3.0 framebuffers)
- love.graphics.isSupported("mrtcanvas") was added
- love_Canvases[n] (0-based array of active canvases) can be written to in pixel shaders in the 'effects' callback function
- everything drawn to multiple canvases at once will be duplicated to all canvases if no shader is active or the standard 'effect' shader function is used
--HG--
branch : MRTs
This commit is contained in:
@@ -47,7 +47,15 @@ int w_Canvas_renderTo(lua_State *L)
|
||||
if (!lua_isfunction(L, 2))
|
||||
return luaL_error(L, "Need a function to render to canvas.");
|
||||
|
||||
canvas->startGrab();
|
||||
static std::vector<Canvas *> attachments;
|
||||
try
|
||||
{
|
||||
canvas->startGrab(attachments);
|
||||
}
|
||||
catch (love::Exception &e)
|
||||
{
|
||||
return luaL_error(L, "%s", e.what());
|
||||
}
|
||||
lua_settop(L, 2); // make sure the function is on top of the stack
|
||||
lua_call(L, 0, 0);
|
||||
canvas->stopGrab();
|
||||
|
||||
Reference in New Issue
Block a user