Martin Fouilleul
3615775168
[canvas] decompose image atlas API into simple rect atlas API + image atlas helpers. This avoids creating a bunch of new types/handles, and exposes the underlying image/sourceRegion so that user code can freely use these for more complex scenarios (eg drawing only a sub-region of an atlased image, or using an atlas image for arbitrary path filling)
2023-02-28 16:54:39 +01:00
Martin Fouilleul
d4bceba7e9
[canvas] basic image atlas API
2023-02-28 13:16:36 +01:00
martinfouilleul
9cb4aedbc5
[canvas, gl] use pre-multiplied alpha in draw shader and when compositing batches
2023-02-27 19:50:18 +01:00
martinfouilleul
ac6a5db209
[canvas, gl] Checked batching/transparency
2023-02-27 19:39:26 +01:00
Martin Fouilleul
5fa07cb462
adding image with transparency (top512.png) in resources to test transparency/overlaying
2023-02-27 19:34:54 +01:00
martinfouilleul
8f834fa1a5
[wip, canvas, gl] implementing basic image API
2023-02-27 19:25:41 +01:00
Martin Fouilleul
5e5f8ac5e7
adding image test/example
2023-02-27 15:43:41 +01:00
Martin Fouilleul
30aa6a4a48
[canvas] Put primitive's transform in the attributes struct. When rendering, set current transform at the beginning of mg_next_shape(). (This avoid using an additional prevTransform matrix to correctly setup uvTransform when mg_finalize_shape() at the beginning of mg_next_shape())
2023-02-27 15:01:44 +01:00
Martin Fouilleul
d195fb1f61
[canvas, mtl backend] Compute each layer with pre-multiplied alpha, starting from transparent color. Composite them to surface with premultiplied alpha too.
2023-02-27 14:24:59 +01:00
Martin Fouilleul
9ed630fc55
[canvas]
...
- Clear final surface to clear color, and enable blending layers onto it
- Fixed Batching bug where we were writing to vertex/shape buffers while the previous batch is using them
- Fixed bug where uvTransform uses transform of next shape instead of that of shape being finalized
2023-02-27 11:56:04 +01:00
Martin Fouilleul
e66932e624
[canvas] Set command attributes to canvas->attributes by default in mg_push_command()
2023-02-25 15:35:24 +01:00
Martin Fouilleul
193afb61fd
[canvas] move canvas structs decl from graphics_internal.h to graphics.c, keep only surface/canvas backend interface stuff in graphics_internal.h
2023-02-25 15:23:15 +01:00
Martin Fouilleul
074b17b743
[canvas] Set transform matrix as part of primitive and don't replay push/pop during render
2023-02-25 14:20:07 +01:00
Martin Fouilleul
b24de5d969
[canvas] Allow setting image source region
2023-02-25 12:59:49 +01:00
Martin Fouilleul
50569a1427
Allow setting texture on arbitrary path fills
2023-02-24 23:06:39 +01:00
Martin Fouilleul
4333ed02b0
[canvas] remove image draw commands, replace with rect/rounded rects + image source
2023-02-24 22:59:33 +01:00
Martin Fouilleul
1b62ec568c
[canvas, mtl backend] Handle image rotation
2023-02-24 20:40:16 +01:00
Martin Fouilleul
bb106b717f
Build user-space bounding box of shape in mg_push_vertex() _before_ transforming vertices
2023-02-24 19:20:05 +01:00
Martin Fouilleul
11c25bf001
Make transform implicit in mg_push_vertex()
2023-02-24 19:11:03 +01:00
Martin Fouilleul
5be019d166
[canvas, metal] compute uv coords in shader using uvTransformed computed in canvas backend, using shape bounding box, image dimension, source and dest regions
2023-02-24 18:50:46 +01:00
Martin Fouilleul
fd4c4e7be3
[canvas] simple image API
2023-02-24 12:01:00 +01:00
Martin Fouilleul
d1b71110bb
- Fixed metal canvas backend's drawBatch argument order
...
- Removed texturing in metal shader while we work on image API
- Started working on simple image API
2023-02-23 18:30:47 +01:00
Martin Fouilleul
2b60db292a
[wip] image api
2023-02-23 17:07:41 +01:00
martinfouilleul
1250dfd7c1
hardcode GL/GLES versions per-platform for now
2023-02-22 18:30:10 +01:00
martinfouilleul
4b9b182762
Removed todo. Track todos/dev notes/etc in external obsidian vault for now
2023-02-22 17:21:31 +01:00
martinfouilleul
0f5c93b767
[win32 build] use /DELAYLOAD option for libEGL and libGLESv2 to allow apps that don't use GLES backend to work without redistributing those unused DLLs
2023-02-21 19:02:16 +01:00
martinfouilleul
665c63c3d0
[win32 build/link]
...
- Build milepost as a dynamic library
- Add import/export directives to public API symbols
- Change example build scripts accordingly
2023-02-21 18:43:30 +01:00
Martin Fouilleul
dc2961f513
updated todo
2023-02-21 17:22:18 +01:00
Martin Fouilleul
3b26c92c85
[osx build/linking]
...
- Remove the need for client apps to explicitly link with all dependent libs and frameworks
- Don't require redistributing libEGL/libGLES if not used, by linking them with '-weak-l' option
- Change examples build scripts accordingly
2023-02-21 17:09:26 +01:00
Martin Fouilleul
94373d12ae
[surface] extracted common layer functionality from osx surfaces. Use layer in platform-agnostic egl surface.
2023-02-21 13:40:30 +01:00
martinfouilleul
9ea9ea7636
[surface] abstracted child window layer from win32 surfaces
2023-02-21 12:35:22 +01:00
martinfouilleul
5ac512c15e
[wgl] Keep dummy window/context around for gl context creation, and don't reload wgl functions every time
2023-02-20 20:20:52 +01:00
martinfouilleul
64d7b31e5c
destroy gles surfaces resources
2023-02-20 19:38:24 +01:00
martinfouilleul
2dccfa5547
[win32 surfaces] Backing win32 surfaces with child window and implementing frame/hidding control
2023-02-20 18:34:29 +01:00
Martin Fouilleul
4306d0a01c
back osx surfaces by CALayer
2023-02-20 16:49:44 +01:00
Martin Fouilleul
2232b647ed
reintroduced GLES backend to osx
2023-02-20 11:05:01 +01:00
martinfouilleul
9eaa125129
add GLES headers to ext
2023-02-17 18:57:01 +01:00
martinfouilleul
333d3e9f9c
[gles, wip] reintroducing egl surface (for win32 at first)
2023-02-17 18:56:16 +01:00
martinfouilleul
20e425494f
Use a custom GL loader to allow different versions of GL/GLES APIs to co-exist. The loader fills an api struct with GL functions pointers.
...
We have a per-thread pointer to select which api struct is used, and GL functions are pound-defined to call the versions in that struct.
GL/GLES surfaces can use one of the loader function to load their api, and the prepare proc of the surface sets its api as the current one
before gl calls are issued.
2023-02-16 19:35:01 +01:00
Martin Fouilleul
54df26232c
[wip, opengl] include gl headers in generated glapi files
2023-02-16 15:16:51 +01:00
Martin Fouilleul
a32e2165c7
[wip, opengl] parsing opengl xml spec to auto-generate gl/gles loader
2023-02-16 13:59:11 +01:00
martinfouilleul
80ea8db687
[surface/canvas cleanup]
...
- Make build-time and runtime backend selection a bit easier
- Reorganized backend-specific files with slightly more coherent naming scheme
2023-02-10 16:56:10 +01:00
martinfouilleul
f54f639db5
properly destroying windows and fonts
2023-02-10 12:05:52 +01:00
martinfouilleul
08d3521b61
[canvas/surface cleanup]
...
- properly destroy gl canvas backend
- properly destroy gl surface
2023-02-09 18:40:42 +01:00
martinfouilleul
af7cbae1fa
[canvas cleanup] cleanup canvas resources on creation failure
2023-02-09 18:18:12 +01:00
martinfouilleul
35e396e4c4
[canvas cleanup]
...
- Remove attributes/color arguments in functions where we don't need them anymore (since they're defined when calling mg_next_shape())
- Renamed "_with_zindex" functions with "_path" -> these function only fill a path (eg rect), but don't increment the current shape
2023-02-09 17:02:58 +01:00
martinfouilleul
09a18419e4
[canvas] make shapeIndex implicit in calls to mg_push_vertex
2023-02-09 16:42:02 +01:00
martinfouilleul
4e816a838b
[Clean canvas/shaders]
...
- Simplified shader names, prefix embedded strings by "glsl_"
- Extracted shader compilation in common function
- Add shader version string and common structs in canvas code rather than in every shader file
- Renamed zIndex with shapeIndex everywhere
2023-02-09 16:14:15 +01:00
martinfouilleul
4a8c77f023
- Move and Zoom perf_text example with the mouse
...
- Reverted to using 4 bits of subpixel precision and computing cross products with 32 bits integers, for perf reasons
- Fixed some confusion in tile array size vs number of elements (could still clean-up naming a bit though)
- Fixed bug where triangles on the left or below canvas boundaries where bucketted to the first colum/row of tiles
- Fixed bug in mouse button message handling (was always sending press on left button)
2023-02-09 13:09:41 +01:00
martinfouilleul
833767d6e2
move text with the mouse in perf_text example
2023-02-09 09:50:53 +01:00