Minimal Cross-Platform Graphics
zserge.com
Minimal Cross-Platform Graphics
1–10 of 67 posts
Re: Minimal Cross-Platform Graphics
#2Re: Minimal Cross-Platform Graphics
#3To be able to call that function, I LoadLibrary("dwmapi.dll"), and then GetProcAddress(dwm, "DwmFlush").
Re: Minimal Cross-Platform Graphics
#4For the rendering, ideally it needs GPU support.
Input needs much more work, here's an overview for Windows: http://blog.ngedit.com/2005/06/13/whats-broken-in-the-wm_key...
Windows' Sleep() function has default resolution 15.6ms, that's not enough for realtime rendering, and relatively hard to fix, ideally need a modern OS and a waitable timer created with high resolution flag.
Here's my attempt at making something similar, couple years ago: https://github.com/Const-me/Vrmac
Re: Minimal Cross-Platform Graphics
#5This example I think needs editing:
memset(f->buf, rgb, f->width*f->height*sizeoof(uint32_t));
it's described as a way to "fill the complete framebuffer with a solid colour", but 'rgb' is shown in the previous snipped to be 'uint32_t'. That is not how 'memset()' [1] works, it will only use the least significant 8 bits of the 'int'-typed value argument. So it would use whatever blue bits where in 'rgb', only.For clearing (all zero) it's usable, and then I would recommend writing it as:
memset(f->buf, 0, f->width * f->height * sizeof *f->buf);
this both fixes the typo ("sizeoof" sounds like a C lecturer being punched in the guts), and avoids duplicating the type and instead inferring it from the actual object, which is more DRY and a style I've been advocating for ... years.Re: Minimal Cross-Platform Graphics
#6I think this needs much more complexity to be useful. For the rendering, ideally it needs GPU support. Input needs much more work, here's an overview for Windows: http://blog.ngedit.com/2005/06/13/whats-broken-in-the-wm_key... Windows' Sleep() function has default resolution 15.6ms, that's not enough for realtime rendering, and relatively hard to fix, ideally need a modern OS and a waitable timer created with high re…
Very easy to fix. Call this at the start of your real-time process:
https://learn.microsoft.com/en-us/windows/win32/api/timeapi/...
Use an argument of 1, and windows will come knocking at ~1Khz. This is extremely effective in my experience. Allows you to do some pretty crazy stuff on 1 thread.
Re: Minimal Cross-Platform Graphics
#7Re: Minimal Cross-Platform Graphics
#8I think this needs much more complexity to be useful. For the rendering, ideally it needs GPU support. Input needs much more work, here's an overview for Windows: http://blog.ngedit.com/2005/06/13/whats-broken-in-the-wm_key... Windows' Sleep() function has default resolution 15.6ms, that's not enough for realtime rendering, and relatively hard to fix, ideally need a modern OS and a waitable timer created with high re…
Re: Minimal Cross-Platform Graphics
#9Re: Minimal Cross-Platform Graphics
#10Could this be compiled as an αpε? Such a thing would make many heads explode.