Comments (7)
This is quite a bummer.
I'm currently working on this little 2d rendering engine and this would be very much needed for any 2d game with sprites.
I've read the contributing.md, but this can't be added as a PATCH.
Best would be to add something like
toHtmlWithEvenMore
: { alpha: Bool, depth: Bool, stencil: Bool, antialias: Bool, premultipliedAlpha: Bool }
-> List FunctionCall
-> List (Attribute msg)
-> List Renderable
-> Html msg
(Info to these properties here)
This would be a MINOR change.
I left out two properties because I don't really understand the first one and because I think the second one would be useless in elm:
- preserveDrawingBuffer: If the value is true the buffers will not be cleared and will preserve their values until cleared or overwritten by the author.
- failIfMajorPerformanceCaveat: Boolean that indicates if a context will be created if the system performance is low.
I'm currently also doing the little shader trick from @w0rm combined with BlendFunc (One, OneMinusSrcAlpha)
, but this isn't a good solution.
The problem with this solution is that you also have to change the rendering order. This makes rendering multiple objects very unintuitive for a user.
from elm-webgl.
Possible alternative to @Zinggi API suggestion: What if we extended the Capability type to cover these attributes?
Then there would be no need to add a new toHtml
-type function... you could just call Disable PremultipliedAlpha
to your FunctionCall
list. This would be a less invasive API change.
I realize that premultipliedAlpha is not actually a function call, but from an implementation perspective I don't see a problem with treating it like one. What would y'all think? Would this be confusing?
from elm-webgl.
@nphollon, I like the suggestion, but there is a problem with it.
You can use List FunctionCall
as an agrument to renderWithConfig
too.
Now with your suggestion you could then write a nonsense renderWithConfig [Enable PremultipliedAlpha]
which doesn't make sense on a per render basis, as it (premultipliedAlpha) only applies to the top-level canvas element.
It would be a way to avoid bumping the version, but it wouldn't be the best API.
I think someone has to bother Evan for this. It's not critical, but it would be a big improvement. I would go ahead and implement it, but first I have to know whether a pull request would even be accepted.
from elm-webgl.
Good point, I had forgotten about renderWithConfig
. (It would have required a version bump anyway, since it would involve changing a type definition.)
As for whether the PR would be accepted, you can get approval from either @evancz or @johnpmayer. We also have #32 waiting for approval at the moment. I think it would make sense to release the updates together if they both get the thumbs up.
from elm-webgl.
All right, I'll try to get my hands dirty on this one.
Will take some time though, as I haven't done native stuff yet.
from elm-webgl.
Ok, so I implemented this here: #38
from elm-webgl.
This is implemented as the part of 2.0.
from elm-webgl.
Related Issues (20)
- Repository field in elm-package.json affects correctness of generated Javascript HOT 2
- Drop elm- from package name
- Extract a task to load image into separate project
- Unify code formatting in the Native module HOT 2
- Examples lead to 404 HOT 2
- Package hardwired to elm-lang/core 4.0.0
- Nothing gets rendered until the program receives it's first message HOT 2
- JS Interop: Direct Access to "draw()"? HOT 5
- Interactivity: Picking HOT 5
- Host examples on gh-pages? HOT 24
- Exploding textures cache HOT 1
- Is is possible to add constants to the vertex array data? HOT 5
- Support the advanced mode of google closure compiler HOT 3
- Provide the ability to load a texture without an implicit UNPACK_FLIP_Y_WEBGL HOT 1
- Provide the ability to render a mesh with supplied vertices and indices.
- Adding Elm 0.18 HOT 4
- Publish a version with deprecation notice
- Respect Evan's constraints on this package HOT 6
- Broken link in README HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elm-webgl.