-
Notifications
You must be signed in to change notification settings - Fork 31
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
good_web_game::graphics::draw not working correctly on Windows #69
Comments
Hmm... thanks for sharing. |
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). However on Windows it looks like this: |
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 If you could fork gwg and just change this one number and see whether this seemingly solves your problems I'd be very grateful. |
You were right, using the MeshBatch solved the issue. |
Glad to hear that :) |
In my game I am doing something like this in order to draw multiple rectangles using a single
Mesh
instance (in different destinations of course, but I deleted that code for brevity):This works fine on Linux (Ubuntu 22.04)
However when running the same code on Windows it looks like this:
I don't know what the issue is, but it seems only one (the last) out of three rectangles got drawn.
Also there were similar issues with drawing text, where text from one draw call got mixed up with another, but I fixed that by using the
queue_text
function.The text was updated successfully, but these errors were encountered: