Comments (5)
Hmm... thanks for sharing.
Does the blend modes example run properly for you? It too draws a single mesh multiple times similarly to what you're doing and last time I checked it ran fine on Windows (but I guess I'm gonna re-check just to be sure).
from good-web-game.
Yes, the blend modes example is working fine - it is behaving the same way as it is on Linux.
We can take a look at another issue. I added a debug draw mode, where the grid for collisions is drawn (and some other stuff aswell eg. number of objects drawn, player's grid index, guard's rays).
This is correctly drawn on Linux:
However on Windows it looks like this:
The grid is actually flashing at a higher rate, but since I lowered the fps you can't really see that, however it gets the point across.
You can also see the text not being drawn correctly in the top-left, if you compare it to the one being drawn on Linux (I didn't use graphics::queue_text here). It says "player grid" instead of number_of_objects_drawn / total_number_of_objects
. Upon further inspection I noticed the text was actually drawn correctly on the first frame of debug draw, but it gets replaced with "player grid" on all the other frames.
from good-web-game.
Ok, my assumption here is that these bugs are related to #59, or, more precisely, the fix I used for it.
I added this to keep bindings of dynamically allocated meshes alive for one more frame before being dropped, which solved a bug particular to Windows and Nvidia graphics as far as I know: Just dropping the bindings after they were used wasn't really workable there, as their meshes wouldn't get drawn then, probably due to the necessary resources having been released before they were no longer needed.
I realize that this is a very crude twigs-and-duct-tape fix to the problem though.
In your case it might or might not help to simply crank the number of frames (currently 1) up by one or two. If that works I would merge that change into the master branch, in order to hopefully avoid such problems for others (though I realize it's still just twigs and even more duct tape, but hey, at least somewhat of an improvement, maybe).
A more reasonable approach might be to not create, use and then drop the meshes inside of your draw or update cycle, but to instead have them created once and then stored somewhere, until you're sure that you no longer need them.
One advice that I'd definitely give you is to try out the MeshBatch
struct for drawing a single mesh multiple times, as it uses instanced drawing, thereby probably improving performance and possibly even solving your problem all on its own (though this is just a wild guess).
If you could fork gwg and just change this one number and see whether this seemingly solves your problems I'd be very grateful.
from good-web-game.
You were right, using the MeshBatch solved the issue.
Since this worked, I didn't fork gwg and do what you said, so I unfortunately cannot give any feedback for that.
from good-web-game.
Glad to hear that :)
I'll still keep this open as it's likely that someone might run into such an issue again.
from good-web-game.
Related Issues (20)
- How to log message in wasm? HOT 2
- shaders HOT 1
- filesystem
- screenshot
- wasm-bindgen HOT 8
- blend modes behave differently than in ggez
- Canvases and multisampling HOT 3
- `TypeError: wasm_exports.crate_version is not a function` HOT 1
- Memory deallocation bug in `Drawable`s HOT 2
- WASM support for RNG HOT 3
- incompatible gl.js version HOT 2
- WASM failed to load, probably incompatible gl.js version HOT 3
- to_rgba8 support HOT 2
- Versioning issues while compiling for android HOT 2
- unresolved imports `quad_snd::decoder`, `quad_snd::mixer::Sound`, `quad_snd::mixer::SoundMixer` HOT 1
- "No such file or directory" when building for Android HOT 4
- shadows example
- WASM runtime errors HOT 2
- JS file doesnt work *WASM failed to load, probably incompatible gl.js version* 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 good-web-game.