Coder Social home page Coder Social logo

Comments (5)

PSteinhaus avatar PSteinhaus commented on August 26, 2024

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.

MOj0 avatar MOj0 commented on August 26, 2024

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:
linux

However on Windows it looks like this:
windows
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.

PSteinhaus avatar PSteinhaus commented on August 26, 2024

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.

MOj0 avatar MOj0 commented on August 26, 2024

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.

PSteinhaus avatar PSteinhaus commented on August 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.