mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
Fix Issue #476: Add HDR Canvas (thanks, Alexander Szpakowski!).
* Add `love.graphics.isSupported("hdrcanvas")' to query whether the hardware
actually supports HDR canvases.
* Add optional third argument to `love.graphics.newCanvas(w,h, type)', where
`type' is one of "normal" or "hdr" and defaults to "normal". HDR canvases
use floating point that can have values > 1 to store pixels, allowing for
HDR rendering and other higher level lighting techniques when combined with
pixel effects.
* Add `canvas:getType()'.
This commit is contained in:
@@ -395,14 +395,17 @@ int w_newParticleSystem(lua_State *L)
|
||||
int w_newCanvas(lua_State *L)
|
||||
{
|
||||
// check if width and height are given. else default to screen dimensions.
|
||||
int width = luaL_optint(L, 1, instance->getWidth());
|
||||
int height = luaL_optint(L, 2, instance->getHeight());
|
||||
glGetError(); // clear opengl error flag
|
||||
int width = luaL_optint(L, 1, instance->getWidth());
|
||||
int height = luaL_optint(L, 2, instance->getHeight());
|
||||
const char *str = luaL_optstring(L, 3, "normal");
|
||||
|
||||
Canvas::TextureType texture_type;
|
||||
Canvas::getConstant(str, texture_type);
|
||||
|
||||
Canvas *canvas = NULL;
|
||||
try
|
||||
{
|
||||
canvas = instance->newCanvas(width, height);
|
||||
canvas = instance->newCanvas(width, height, texture_type);
|
||||
}
|
||||
catch(Exception &e)
|
||||
{
|
||||
@@ -820,6 +823,10 @@ int w_isSupported(lua_State *L)
|
||||
if (!Canvas::isSupported())
|
||||
supported = false;
|
||||
break;
|
||||
case Graphics::SUPPORT_HDR_CANVAS:
|
||||
if (!Canvas::isHdrSupported())
|
||||
supported = false;
|
||||
break;
|
||||
case Graphics::SUPPORT_PIXELEFFECT:
|
||||
if (!PixelEffect::isSupported())
|
||||
supported = false;
|
||||
|
||||
Reference in New Issue
Block a user