Commit Graph

3058 Commits

Author SHA1 Message Date
Alex Szpakowski c764f9f206 Support instancing on more systems. Note that GLSL 3 may not be supported everywhere that instancing is, and love_InstanceID requires GLSL 3 (but instanced vertex attributes do not).
--HG--
branch : minor
2017-01-22 21:18:06 -04:00
Alex Szpakowski bea7cfdaab Add low-level hardware instancing support to Meshes.
Add “instancing” Graphics Feature constant.

Add love.graphics.drawInstanced(mesh, instancecount, x, y, …) which draws the mesh multiple times in a single draw call. Each instance of the mesh will appear in the exact same spot unless one of the following are used:

- Add an optional vertex attribute step type argument to Mesh:attachAttribute. “pervertex” is the default. “perinstance” causes the attribute to be per-instance instead of per-vertex, when the mesh is drawn.

- Add love_InstanceID as a built-in read only int variable in GLSL 3 vertex shaders. It is always 0 except when a Mesh is drawn with more than 1 instance specified in the draw call. It can be used to manually compute or index into per-instance values in a shader.

--HG--
branch : minor
2017-01-22 20:52:11 -04:00
Alex Szpakowski 731b5d5cf0 Added support for GLSL 3 shaders (GLSL 3.30 and GLSL ES 3.00).
To use GLSL 3 in a shader, the first line of the shader has to be: #pragma language glsl3

glsl1 is the default language.

Added “glsl3” graphics feature as part of the table returned by love.graphics.getSupported().

Added love.graphics.validateShader(boolean gles, shadercode). It returns a boolean along with an error string if the shader code has errors for its target language and platform (gles or desktop).

Implemented support for Core Profile OpenGL 3.3 in love.graphics.

--HG--
branch : minor
2017-01-22 18:54:04 -04:00
Alex Szpakowski a6669a8bb2 Merge default into minor
--HG--
branch : minor
2017-01-21 12:06:35 -04:00
Alex Szpakowski f45c6a0d74 Fix a crash related to love.graphics.push and love.window.setMode. 2017-01-21 12:03:43 -04:00
Alex Szpakowski 01ff7d1275 Merged in Mastificate/love (pull request #77)
Fix infinite loop bug with bezier curves
2017-01-16 16:51:36 -04:00
Bart van Strien ff336041a9 Clean up autotools build scripts
- Removed unused platform/unix/gen-makefile
- Added current version as suffix to the built library (now liblove-0.11.0.so, for example)
  - Added target version to configure.ac
- Include .lua files as sources, so they get included in 'make dist'

--HG--
branch : minor
2017-01-15 22:07:51 +01:00
Bart van Strien a9a294beb3 Rebuild boot.lua.h 2017-01-15 20:26:21 +01:00
Bart van Strien 2aff0b1199 Remove executable bit from source files 2017-01-15 20:21:38 +01:00
Alex Szpakowski 44dc4bb2a2 Fix font textures in OpenGL ES 3.
--HG--
branch : minor
2017-01-15 11:15:52 -04:00
Alex Szpakowski 734be1afad Add a variant of Mesh:setVertexMap which takes a Data object, an index data type (“uint16” or “uint32”), and an optional index count. Thanks Shell32!
--HG--
branch : minor
2017-01-14 20:35:56 -04:00
Alex Szpakowski 73e5111335 Potentially fix a crash in love.window.setMode.
--HG--
branch : minor
2017-01-14 01:20:07 -04:00
Mastificate 93a15ce983 added error handling for bezier curves and fixed infinite loop bugs 2017-01-13 19:28:09 -05:00
Alex Szpakowski 28ed5e5a4b Actually merge the latest default into minor…
--HG--
branch : minor
2017-01-12 22:55:19 -04:00
Alex Szpakowski c5b7a07064 Merge default into minor.
--HG--
branch : minor
2017-01-12 22:52:24 -04:00
Bart van Strien 9316d84028 Add (optional) copy-to-clipboard functionality to the error handler
Based on pull request #74 by raidho
2017-01-11 11:44:50 +01:00
Alex Szpakowski 06cb7a6db6 Error instead of crash when Source:setLooping is called on a queueable Source (thanks zorg)
--HG--
branch : minor
2017-01-09 22:37:49 -04:00
Alex Szpakowski 22c4d1ae79 Font texture atlases can be created in Core Profile GL3.
--HG--
branch : minor
2017-01-05 23:25:20 -04:00
Alex Szpakowski 8c204efafb Minor pre-emptive fixes for GL3.
--HG--
branch : minor
2017-01-05 22:33:10 -04:00
Alex Szpakowski 656668b8c8 Particle systems use a GLBuffer internally, instead of direct vertex arrays with glDrawElements.
--HG--
branch : minor
2017-01-05 20:27:47 -04:00
Alex Szpakowski e445c50af8 Fix stenciling…
--HG--
branch : minor
2017-01-05 20:22:50 -04:00
Alex Szpakowski 5243fb5a85 Allow disabling stencil capabilities for the main screen in love.window.setMode.
--HG--
branch : minor
2017-01-05 19:40:18 -04:00
Alex Szpakowski 3adc9b45be Fix captureScreenshot when MSAA is used on iOS
--HG--
branch : minor
2017-01-05 14:50:03 +00:00
Alex Szpakowski a653bfa104 Minor batching fixes and performance improvements
--HG--
branch : minor
2017-01-04 22:57:56 -04:00
Alex Szpakowski 551dc423a2 Improved performance slightly when love.graphics.setColor is used heavily with automatic batching.
--HG--
branch : minor
2017-01-03 23:49:29 -04:00
evan yeung 8d269226c0 Let the love.filesystem loader support the template path for multiple interrogation mark. 2017-01-04 02:26:22 +00:00
evan yeung 9b77dbe262 Let the love.filesystem loader support the template path for multiple interrogation mark. 2017-01-04 01:56:27 +00:00
Alex Szpakowski 8899c03651 Add C++ side support for unsigned int shader uniforms. Note that the shader languages love currently supports (glsl 1.20, glsl es 1.00) don’t support uints at the moment.
--HG--
branch : minor
2017-01-02 20:41:07 -04:00
Alex Szpakowski abb72cb813 Happy new year! 🥂
--HG--
branch : minor
2017-01-02 01:28:29 -04:00
Alex Szpakowski bdd51d547f Minor code cleanup
--HG--
branch : minor
2017-01-02 01:21:22 -04:00
Alex Szpakowski 548293e100 Don’t call unnecessary OpenGL APIs in love.graphics.setColor
--HG--
branch : minor
2017-01-02 01:02:15 -04:00
Alex Szpakowski 66749e874f love.graphics Video code is upwards-compatible with GL3.
--HG--
branch : minor
2017-01-01 21:58:13 -04:00
Alex Szpakowski 75fbc210dc Work around crappy Android NDK
--HG--
branch : minor
2017-01-01 13:06:31 -04:00
Alex Szpakowski a986f5e825 Fix iOS build
--HG--
branch : minor
2017-01-01 12:13:17 -04:00
Alex Szpakowski f12596dd19 More code restructuring.
Move all love.graphics functionality that doesn’t call OpenGL out of the OpenGL backend Graphics class.

--HG--
branch : minor
2016-12-30 18:36:54 -04:00
Alex Szpakowski d94b363b39 Move more love.graphics backend-agnostic module code out of the opengl implementation file.
--HG--
branch : minor
2016-12-30 14:32:11 -04:00
Alex Szpakowski c7419e0e37 Move most graphics Font code out of the opengl subfolder.
--HG--
branch : minor
2016-12-30 14:19:07 -04:00
Alex Szpakowski 1383248876 … typo fix
--HG--
branch : minor
2016-12-29 23:59:42 -04:00
Alex Szpakowski bfd1b86059 Add love.graphics.getPixelDensity, gets the pixel density scale of the screen (matches other APIs).
--HG--
branch : minor
2016-12-29 23:59:25 -04:00
Alex Szpakowski d26002f5cc Revamped and streamlined retina / high-DPI support (resolves issue #1122).
With the highdpi window flag enabled on a retina-capable display and OS, content should now appear to the user at the same size and in the same positions as with the flag disabled.

As a result, mouse and touch coordinates, Texture and graphics dimensions, and the graphics coordinate system now use pixel density-scaled units instead of pixels. Raw pixel units should generally only be used for things such as shader algorithms which execute per-pixel and rely on accurate pixel dimensions. love.window.fromPixels and friends typically don’t need to be used anymore.

Images, Canvases, and Fonts can have an optional explicit ‘pixel density’ set when creating them. This allows for easily loading high pixel density content which displays at the same size as regular or low pixel density content.

API changes:

- Added Texture:getPixelWidth/getPixelHeight/getPixelDimensions and Texture:getPixelDensity. Texture:getWidth/getHeight return the pixel density-scaled width and height (as it will appear on the screen when drawn) rather than the number of pixels on each texture dimension.

- Added love.graphics.getPixelWidth/getPixelHeight/getPixelDimensions.

- Added optional ‘pixeldensity’ field to the settings table parameter of love.graphics.newImage. It defaults to 1, or if the file the Image was loaded from has “@2x”, “@3x”, etc. at the end of its name, it uses that number as the pixel density scale by default.

- love.graphics.newCanvas now takes a table as its third parameter, with fields “format”, “msaa”, and “pixeldensity”. pixeldensity defaults to the main screen’s pixel density. The width and height parameters specify the visual size that the Canvas will be drawn at / can be drawn to (pixel density-scaled units).

- love.graphics.newVideo accepts a table as its second parameter, with optional fields “audio” and “pixeldensity”. pixeldensity defaults to 1.

- love.graphics.newFont variants have an optional pixeldensity parameter at the end of the argument list. For TrueType fonts this defaults to the current pixel density scale of the screen, and for BMFonts and ImageFonts this defaults to 1.

- Added Font:getPixelDensity.

- Renamed love.window.getPixelScale to love.window.getPixelDensity.

--HG--
branch : minor
2016-12-29 23:55:51 -04:00
Alex Szpakowski 8aa6725039 Cleaned up some duplicated pixel format-related code in Font files.
--HG--
branch : minor
2016-12-29 02:45:27 -04:00
Alex Szpakowski 4a3889ae48 Use automatic batching for love.graphics.print/printf.
This doesn’t actually improve performance at all in most cases, but it does remove some OpenGL-specific code from the Font files, and reduces the amount of duplicated rendering code. This makes it slightly easier to add support for Core Profile OpenGL 3.

--HG--
branch : minor
2016-12-29 00:25:14 -04:00
Alex Szpakowski 52b7b0f80d Unify separate GL/GLES code paths for love’s built in matrices in shaders.
--HG--
branch : minor
2016-12-28 19:32:43 -04:00
Alex Szpakowski 80f269d252 Improve performance of Shader:send when the Shader is not active.
It now defers uploading the uniforms to the program object until the shader becomes active again, instead of activating the shader program and deactivating it each time Shader:send is called.

--HG--
branch : minor
2016-12-28 16:24:57 -04:00
Alex Szpakowski a78fa39113 Added “none” blend mode. This is equivalent to setBlendMode(“replace”, “premultiplied”) (which also effectively disables blending) but doesn’t require explicitly setting the alpha multiplication mode.
--HG--
branch : minor
2016-12-28 12:32:37 -04:00
Alex Szpakowski 4ef91ed79f Use SIMD SSE functionality when available for 4x4 matrix multiplies. Slightly improves performance of large numbers of love.graphics.draw(texture) calls.
--HG--
branch : minor
2016-12-28 04:05:52 -04:00
Alex Szpakowski 5fc076a8fb Fix compilation on iOS
--HG--
branch : minor
2016-12-28 02:36:31 -04:00
Alex Szpakowski 19aee7e75c Minor optimizations to love.graphics.draw(texture).
--HG--
branch : minor
2016-12-28 01:24:21 -04:00
Alex Szpakowski a6a7f03b3a Fix more Windows compilation issues
--HG--
branch : minor
2016-12-27 23:23:57 -04:00
Alex Szpakowski 603c3e43d5 Moved line and shape drawing code out of the opengl folder, since it no longer directly calls any OpenGL functions.
--HG--
branch : minor
2016-12-27 23:21:25 -04:00