Commit Graph

313 Commits

Author SHA1 Message Date
Alex Szpakowski d8a68d6ce1 Updated iOS-specific graphics code to use the latest SDL changes. 2015-04-13 12:26:54 -03:00
Alex Szpakowski 2844499ef7 Added the ability to have custom vertex attributes in Meshes (resolves issue #768.)
Added new love.graphics.newMesh variants: newMesh(vertexformat, vertices [, drawmode, meshusage]) and newMesh(vertexformat, numvertices [, drawmode, meshusage]).

Replaced the regular love.graphics.newMesh variants with newMesh(vertices [, drawmode, meshusage]) and newMesh(numvertices [, drawmode, meshusage]). To use an image or canvas with a mesh, use Mesh:setTexture.

vertexformat is a table with the following prototype:
{
  {attributename, datatype, components},
  {attributename, datatype, components},
  ...
}

Where attributename is the name of the vertex attribute (can be the built-in names 'VertexPosition', 'VertexTexCoord', or 'VertexColor', or a custom name for use in a vertex shader), datatype is the type of values used for the attribute ('float' or 'byte'), and components is the number of components in the vertex attribute (between 1 and 4.)

The vertex format is used to determine the layout of the vertices in the mesh, for example the 'regular' newMesh variants use this vertex format:
format = {
  {"VertexPosition", "float", 2},
  {"VertexTexCoord", "float", 2},
  {"VertexColor", "byte", 4},
}

The mesh usage parameter accepts the same constants as the spritebatch usage hint in love.graphics.newSpriteBatch - "dynamic", "static", and "stream".

Mesh:setVertex now sets *all* vertex attributes for a specific vertex in the Mesh.

Added Mesh:setVertexAttribute(vertexindex, attributeindex, attributevalue1, ...), which sets the values for a specific vertex attribute in a specific vertex in the Mesh (resolves issue #784.)

Added Mesh:getVertexFormat and Mesh:flush.

Added Mesh:setAttributeEnabled(attributename, enable) and Mesh:isAttributeEnabled(attributename), to enable or disable the use of a specific attribute when drawing the Mesh.

Added Mesh:attachAttribute(attributename, mesh), which makes the Mesh use a vertex attribute from another mesh when drawing the Mesh. This can be used to separate out vertex attributes which are updated at different rates into different meshes, and to share vertex data between multiple meshes.

Removed Mesh:setVertices, Mesh:getVertices, and Mesh:setVertexColors.
2015-04-08 22:24:17 -03:00
Alex Szpakowski cf0968fc6d Avoid some VC++ compiler warnings 2015-04-02 00:28:09 -03:00
Dermoumi Sid 6a07823224 Fixed shearing resetting transformations 2015-03-29 12:37:18 +01:00
Alex Szpakowski a29b349014 Added love.math.compress(data, format [, level]) and love.math.decompress(compresseddata) / love.math.decompress(compressedstring, format).
Renamed the love.image CompressedData type to CompressedImageData.

love.math.compress returns a love.math CompressedData object which holds the newly compressed data. Currently supported formats are "lz4" and "zlib". Note that the formats are not file formats and don't compress filesystem hierarchies.
2015-03-23 11:28:14 -03:00
Alex Szpakowski e237ed2432 love.graphics.discard now accepts a table of booleans indicating which of the active canvases to discard (matches love.graphics.clear.) 2015-03-21 02:36:13 -03:00
Alex Szpakowski d31168c0e0 Cleaned up some graphics code. 2015-03-20 00:16:36 -03:00
Alex Szpakowski 06ef263537 Added OpenGL debug groups for most graphics operations when love is built in debug mode for iOS. The Xcode frame capture tool uses them to create nice visual groups for OpenGL function calls. 2015-03-16 22:55:58 -03:00
Alex Szpakowski 468127eed4 Added a variant of love.graphics.clear which accepts a color table argument for each active canvas, allowing it to clear active canvases to different colors without having to call love.graphics.setCanvas. 2015-03-15 15:15:21 -03:00
Alex Szpakowski b1f4beac56 Fixed the internal color mask state not being updated when love.graphics.setColorMask is called. 2015-03-10 01:13:39 -03:00
Alex Szpakowski 4ef0d257e9 Added an optional font hinting argument to love.graphics.newFont / love.font.newRasterizer when loading TrueType fonts. Resolves issue #963.
Accepted values are "normal", "light", "mono", and "none".
2015-03-07 22:05:37 -04:00
Alex Szpakowski 275a9a300f Multi-canvas rendering (love.graphics.setCanvas with multiple canvases) now allows canvases with different formats, if the system supports it. Added 'multicanvasformats' to the table returned by love.graphics.getSupported.
--HG--
branch : minor
2015-03-02 23:43:09 -04:00
Alex Szpakowski 3fea174008 Cleaned up some shader code.
--HG--
branch : minor
2015-03-02 15:18:12 -04:00
Alex Szpakowski 9a2bf4b210 Fixed the check for OpenGL extensions that support glInvalidateFramebuffer to check for GL_ARB_invalidate_subdata instead of GL_ARB_ES3_compatibility.
--HG--
branch : minor
2015-02-27 23:34:08 -04:00
Alex Szpakowski b52b9c7a2b Added love.graphics.discard, which discards the contents of the screen (or currently active Canvas.)
Using it just after activating a Canvas can improve performance on many mobile devices, if the conditions for using it are right.

--HG--
branch : minor
2015-02-27 04:51:38 -04:00
Alex Szpakowski 1326ae9a5d Added love.graphics.clearStencil, which only clears the stencil buffer.
--HG--
branch : minor
2015-02-27 03:58:40 -04:00
Alex Szpakowski 3efcf3901b Removed Canvas:clear. love.graphics.clear now accepts r,g,b,a values (and defaults to 0,0,0,0 with no arguments given.) love.graphics.clear clears the content of the currently active Canvas(es.)
--HG--
branch : minor
2015-02-27 03:47:25 -04:00
Alex Szpakowski f83c2db471 Cleaned up the Canvas code.
--HG--
branch : minor
2015-02-26 17:06:09 -04:00
Alex Szpakowski 517ee44e84 Fixed Canvases on iOS, added support for Canvas MSAA on OpenGL ES 3.
--HG--
branch : minor
2015-02-24 02:36:32 -04:00
Alex Szpakowski ebc68023a7 Fix many warnings about implicit integer conversions when compiling for 64 bits.
--HG--
branch : minor
2015-02-20 01:20:08 -04:00
Alex Szpakowski e137c9327b Fixed a GL error on startup when OpenGL ES is used.
--HG--
branch : minor
2015-02-18 19:01:19 -04:00
Alex Szpakowski ac2b03e8a4 Added love.graphics.isActive. love.graphics function calls (and method calls on objects created via love.graphics) are only guaranteed to work when isActive is true, otherwise bad things might happen (the program crashing, for example.)
It's usually only false when the app is inactive on iOS, and when the window hasn't been created yet.

--HG--
branch : minor
2015-02-17 02:24:09 -04:00
Alex Szpakowski 67aede6bc0 Merged default into minor
--HG--
branch : minor
2015-02-02 01:13:21 -04:00
Alex Szpakowski f6bd177f84 A debug print statement snuck in there... 2015-01-31 01:35:17 -04:00
Alex Szpakowski 9cf1868b81 Fixed the point style and color mask getting reset in love.window.setMode (thanks Shell32) 2015-01-31 01:22:54 -04:00
Alex Szpakowski 665cdc4ae7 Moved the default Font logic from the graphics.lua script to the Graphics and Font module C++ code. Moved love.graphics.setNewFont from the graphics.lua script to the Graphics module Lua wrapper code. Moved the Vera.ttf data from the graphics.lua script to its own file inside the Font module. 2015-01-31 01:10:38 -04:00
Alex Szpakowski ad1fbbf3ea Merged default into minor
--HG--
branch : minor
2015-01-29 21:27:05 -04:00
Alex Szpakowski cf60cf89fc De-namespaced a class, to make it less verbose. 2015-01-24 04:09:56 -04:00
Alex Szpakowski 222d4cfdc8 Maybe fixed Windows build? 2015-01-24 03:43:52 -04:00
Alex Szpakowski b876255442 Cleaned up some graphics code. 2015-01-24 03:39:05 -04:00
Alex Szpakowski b4bacb38a6 Fixed love.graphics.getShader() to return nil when no shader is set, fixed a potential (harmless) OpenGL error when OpenGL ES is used.
--HG--
branch : minor
2015-01-24 03:21:33 -04:00
Alex Szpakowski 970704c2b7 Added Text objects via love.graphics.newText(font [, textstring]). Reworked the internal code of Font objects to use fewer individual textures and less VRAM per object, and to be compatible with OpenGL ES. Slightly improved the performance of love.graphics.print and love.graphics.printf.
Text objects are Drawable objects that represent text on the screen. They decouple text drawing from text parsing and vertex uploading, in a similar manner to SpriteBatches. They also optionally allow efficient batching of text from the same Font in different relative coordinate transformations, without having many draw calls.

Text objects currently have the following methods:

Text:set(textstring) -- replaces any existing text in the object with the new string.
Text:setf(textstring, wraplimit, alignmode) -- replaces any existing text with formatted text using the new string.

Text:getFont() -- gets the Font object used for this Text object.
Text:getWidth() -- gets the width in pixels of the most recently added text in the Text object.
Text:getHeight() -- gets the height in pixels of the most recently added text in the Text object.

Text:add(textstring, x, y, angle, sx, sy, ox, oy, kx, ky) -- adds a new string to the text object using the specified relative coordinate transformation, without replacing existing text. This behaves much like SpriteBatch:add.
Text:addf(textstring, wraplimit, alignmode, x, y, angle, sx, sy, ox, oy, kx, ky) -- adds a new formatted string to the text object using the specified relative coordinate transformation.
Text:clear() -- clears all text from the object.

--HG--
branch : minor
2015-01-23 00:47:28 -04:00
Alex Szpakowski 27aec48d1a Updated love.graphics.polygon and love.graphics.point to work with OpenGL ES.
--HG--
branch : minor
2015-01-22 18:28:24 -04:00
Alex Szpakowski 5b98083e01 Merged default into minor
--HG--
branch : minor
2015-01-22 02:18:56 -04:00
Alex Szpakowski 15538426d7 Added support for creating OpenGL ES 2 and 3 contexts, and updated the OpenGL context creation code to be more robust in general.
If the LOVE_GRAPHICS_USE_OPENGLES environment variable is set, then love will try to create an OpenGL ES context before falling back to regular OpenGL. If it's not set (or set to 0), then the opposite happens except when love is run on backends that should always use OpenGL ES.

--HG--
branch : minor
2015-01-22 01:02:01 -04:00
Alex Szpakowski 18569979e9 Better cleanup when the graphics and window subsystems are destroyed and restarted. 2015-01-21 18:23:16 -04:00
Alex Szpakowski 5df56d041a Added GLSL ES 1.00 (OpenGL ES 2) shader support.
--HG--
branch : minor
2015-01-20 22:31:54 -04:00
Alex Szpakowski 8067d42df2 Canvases now have OpenGL ES support, updated Texture:setWrap to return false for repeat wrap modes in non-power-of-two textures if OpenGL ES 2 is used and the implementation doesn't have support for repeat on NPOT textures.
--HG--
branch : minor
2015-01-20 15:13:59 -04:00
Alex Szpakowski 1124612c1f Some work towards OpenGL ES 2+ support for love 0.10.
--HG--
branch : minor
2015-01-19 23:32:16 -04:00
Alex Szpakowski a7e4148869 Merged default into minor
--HG--
branch : minor
2015-01-16 15:47:26 -04:00
Alex Szpakowski c7b45b3505 Updated copyright for the new year 2014-12-31 19:32:43 -04:00
Alex Szpakowski 5eb37d30f7 Cleaned up and simplified some graphics code.
--HG--
branch : minor
2014-10-26 15:31:32 -03:00
Alex Szpakowski 34688e929e Merged default into minor
--HG--
branch : minor
2014-09-28 15:56:04 -03:00
Alex Szpakowski 808e533b02 Tweaked streaming Sources to use fewer OpenAL buffers (and increased the amount of decoded data per buffer to compensate), and removed some unnecessary #include statements. 2014-09-28 14:58:59 -03:00
Alex Szpakowski b70f72acb3 Fixed a couple potential memory leaks if love.graphics.newShader causes an error, and cleaned up some shader-related code. 2014-09-27 02:26:58 -03:00
Alex Szpakowski fffbd3ecab Merged default into minor
--HG--
branch : minor
2014-09-18 02:15:20 -03:00
Alex Szpakowski f972c9923f Fixed love.graphics.reset reverting the current font to nil and breaking love.graphics.print. 2014-09-11 02:42:56 -03:00
Alex Szpakowski 6f6bf6a2bb Merged default into minor
--HG--
branch : minor
2014-08-30 22:08:10 -03:00
Alex Szpakowski 68b2c9e851 The default filter mode is now included in the state affected by love.graphics.push("all"). 2014-08-29 01:31:16 -03:00
Alex Szpakowski 3a51f0ad08 Changed the love.graphics internal code to always use a default shader when none is set externally, and replaced the deprecated OpenGL vertex attribute code with the equivalent generic vertex attribute functions.
This will simplify the code and make it more maintainable when OpenGL ES 2+ support is added, compared to using the deprecated VA functions on desktop GL and the generic VA functions on GLES.

--HG--
branch : minor
2014-08-26 03:24:42 -03:00