New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mesh does not support DrawParams::color #215
Comments
Ah, this is a docs issue rather than a code issue - A bit of background as to why - when you draw a texture, that effectively generates a With a mesh however, the I think the way to fix this would be to make it so two colors are passed to the shader - a per-vertex color and a per-mesh color. Then I can make I will probably do this in the next version of Tetra, but I need to have a bit of a look at how other frameworks handle this first to make sure I'm not doing anything silly 😄 It'd also potentially be a breaking change for any existing custom shaders, so I'll have to make it a 0.6 release. But I kinda needed to do that anyway. In the meantime, it's possible to tint a mesh using a custom shader (pass in the color as a uniform and then multiply the vertex color by it). I appreciate that's a bit of a pain to do though. |
Aha, Love2D does exactly what I suggested (seperate shader inputs for vertex and mesh color). So that seems like a reasonable approach. Thank you for the report, I'll make sure that gets done soon! |
So it's time for me to dive into shaders. 😄 |
Once the fix is done, your original code should work fine without custom shaders, so the alternative is to just wait a few days 😛 But shaders are a fun thing to learn, so feel free to play around with them in the meantime! The steps for the workaround would something like:
|
🎉 Glad you were able to get it working! I usually wouldn't recommend calling I'll leave this issue open until the proper fix is done. |
0.5.5 has been published with a fix for this issue. I opted to keep vertex colours and mesh colours seperate, as trying to use a unified approach didn't really work very well with batched rendering. There's now an extra parameter ( |
Oof! You told me to wait a few days ... you circle the sun much faster than me 😀 |
I couldn't help myself, leaving it broken till the weekend would have driven me crazy 😅 |
It works perfectly 🙏 |
Here is my mesh creation
When I draw it (and try to change the color with DrawParams)
thinking my code had a problem, I performed the same test with the mesh.rs example (removing the texture). Same result, the color does not change
The text was updated successfully, but these errors were encountered: