Better HN
topnewbestaskshowjobs
Log inSign up

tsherif

96 karma · joined May 9, 2011 (15y ago) · 45 submissions

http://tareksherif.net/
Submissions

1.

Space-Shooter.c Ported to WebAssembly/Emscripten(tsherif.github.io ↗)

2 points · by tsherif · 4y ago · discuss

comment 4y ago · link · parent

Thank you!

comment 4y ago · link · parent

Thank you!

comment 4y ago · link · parent

Thanks! Nothing against SDL. It's a great library, and I referenced its source code a lot while writing the platform layers. But I did find it incredibly satisfying to write everything myself. If you do ever decide to take a crack at it, I highly recommend Handmade Hero as a starting point: https://handmadehero.org/

comment 4y ago · link · parent

Thanks for the tip! I'll try to figure out if something similar is happening on either of the machines I'm using. That's a bummer that an in-place update function would be allocating behind the scenes...

comment 4y ago · link · parent

Thanks! My first child was born last year, and I started a new job 3 months earlier, so time was definitely not an abundant resource! But between the stress of all that and the pandemic, I found squeezing in an hour or two for this project here and there was one of the few things keeping me sane, and that's what got me through it.

comment 4y ago · link · parent

Ack! Right I hadn't thought of that. I'll have to decide if I'm ok with breaking the "written in standard C" constraint on this project...

comment 4y ago · link · parent

Thanks! I definitely tried to focus on only using as much abstraction as was actually helpful in getting it to work the way I wanted it to.

comment 4y ago · link · parent

Sweet, thanks for sharing! I'll definitely take a look.

comment 4y ago · link · parent

Thanks! This was a revelation for me on a few levels:

1. That memory management doesn't have to be scary with a little forethought, at least for programs where you can set a reasonable upper bound on the resource requirements.

2. That it's possible to structure at least a subset of programs in such a way that error states can only be entered during initialization, and that makes the rest of the program much easier to reason about.

comment 4y ago · link · parent

> i even found out that a call like glBufferSubData will call malloc or related functions. so doing that on each frame seems to be a bad idea as well.

That's interesting and not what I'd expect at all! Is there documentation you could point me to or did you find that out with some tooling? And is there a better way to update attribute buffers for instanced draw calls?

comment 4y ago · link · parent

Hadn't seen this before, but that's a flattering comparison. Thanks!

comment 4y ago · link · parent

That's an interesting idea. Probably won't change the format for this project, but something I might consider in future ones. Thanks for the tip!

comment 4y ago · link · parent

In a sense, I did use SDL. The source code of SDL, along with GLFW and Sokol, were my primary references when writing the platform layers.

comment 4y ago · link · parent

For now, it's Windows/Linux only. I hope to write a Mac platform layer eventually. I just don't currently have a Mac machine to work on...

comment 4y ago · link · parent

Thanks!

If you go through the architecture doc (which I'm almost done writing), you'll find links to most of the references I used: https://github.com/tsherif/space-shooter.c/blob/master/ARCHI...

Top one, though, would be Handmade Hero: https://handmadehero.org/

17.

Simple OpenGL Loader: A cross-platform, (almost) single-file C/C++ OpenGL loader(github.com ↗)

2 points · by tsherif · 5y ago · discuss

18.

Tesseract Explorer: Explore a 4-dimensional tesseract in WebGL(tsherif.github.io ↗)

1 points · by tsherif · 6y ago · discuss

19.

Mercator-gl: A tiny library for GLSL web mercator projections(tsherif.github.io ↗)

1 points · by tsherif · 6y ago · discuss

20.

WebGPU Examples: Small Examples of SPIR-V Compatible WebGPU Usage(github.com ↗)

2 points · by tsherif · 6y ago · discuss

21.

Glcheck: A testing framework for WebGL 1 and 2 applications(github.com ↗)

2 points · by tsherif · 6y ago · discuss

22.

WebGL 2 Development with PicoGL.js(tsherif.wordpress.com ↗)

2 points · by tsherif · 9y ago · discuss

comment 9y ago · link · parent

Yeah, I was fiddling with the parameters until I found something I kind of liked. A couple of important factors:

1. Stiffness of the cloth depends on the number of particles vs. the number of iterations you do to resolve the constraints (maybe there's a way to speed this up?). So making things stiffer (at the same grid resolution) does take more time.

2. The faster things are moving, the higher the likelihood that that collisions will be missed. You can already see this if you move the ball very quickly, it can pass through the cloth. With higher gravity, I found the cloth would often get pushed through the ball.

If you want to fiddle around with it, you can clone and tweak the physics parameters here:https://github.com/tsherif/picogl.js/blob/master/examples/cl... and the simulation parameters here: https://github.com/tsherif/picogl.js/blob/master/examples/cl...

comment 9y ago · link · parent

Totally! And it's still crazy to me that you can just send out a link to share this kind of thing with people.

comment 9y ago · link · parent

Yeah, for sure. Not doing any self-collision detection. If you know of any good references for how to that on the GPU, I'll give it a shot.

comment 9y ago · link · parent

The basic system is pretty simple: just make sure the points you're tracking on the cloth don't move further than a certain distance away from each other. Doing it on the GPU is a bit tricky because you have to know which constraints you can check in parallel.

Here are the two primary references I used: https://viscomp.alexandra.dk/?p=147 http://http.download.nvidia.com/developer/presentations/2005...

comment 9y ago · link · parent

It looks like this might be an issue with Apple's AMD driver, since everyone who's having problems seems to be on Mac/AMD setup. I'll look into this when I get my hands on a machine to test on.
12