Live data from Hacker News

Olive.c: a simple graphics library that does not have any dependencies

tsoding.org

61–70 of 96 posts

Re: Olive.c: a simple graphics library that does not have any dependencies

#61
post #17

Does this use WebGL2? It doesn't run on my phone (which does support WebGL 1). Edit: According to the JS source file it appears to be a plain 2D canvas. Now I am even more confused, those should definitely load! https://github.com/tsoding/olive.c/blob/master/js/vc.js

Depending on your privacy settings, your anti fingerprinting configuration may block canvas operations. I know some stringent Firefox fingerprinting protection used to do this, not sure if that has been refined since.

Re: Olive.c: a simple graphics library that does not have any dependencies

#62
post #5

Cool project! What’s the motivation? Since it eschews any graphics API, is it safe to assume this only does CPU-based rendering?

From demos/triangle.c ( https://github.com/tsoding/olive.c/blob/master/demos/triangl... ) // This idea is that you can take this code and compile it to different platforms with different rendering machanisms: // native with SDL, WebAssembly with HTML5 canvas, etc. The goal seems to be to maximize portability.

i understand that it is more portable but if it is cpu based, i guess its power performance is terrible since it is not using gpu acceleration which is a priori more efficient

Re: Olive.c: a simple graphics library that does not have any dependencies

#63

Earlier quoted context omitted.

Sorry, why does it make the project feel like a toy? I'm not trying to argue, I just don't understand. Is it because you're including a source file instead of a header file?

single-file libraries almost always feel like toys because most serious projects i'd want them integrated into a real build system. vcpkg is a good one these days for c/cpp. nothing wrong with a toy library ofc.

Just saying that these "feel like toys" is a very low-effort comment. Header-only libraries exist even if uncommon and they work fine when written properly.

If you actually use a header-only library and it fails to link properly or be used in a project with multiple compilation units, then that would be a bug in the header-only library worth discussing and fixing. That would be a good-effort and interesting comment.

Re: Olive.c: a simple graphics library that does not have any dependencies

#66
Cool use of Webassemly! See also the 500 line https://github.com/ssloy/tinyrenderer or the 100 line Python/numpy version https://github.com/rougier/tiny-renderer

Both cpu renderers with texture mapping and Wavefront obj import without further dependencies.

Re: Olive.c: a simple graphics library that does not have any dependencies

#67

Earlier quoted context omitted.

Unfortunately only portable to systems with fast CPUs though. Although I guess rendering simple 3d shapes probably runs just fine on low end hardware.

It depends how fast “fast” is. PCs in the 90s could run games like quake in lower quality mode with lower framerates, but they ran. CPUs that we have now are many orders of magnitude more powerful, so imagine what you can do with that. Though most games don't bother so we don't really have actual evidence.

Quake used hand-coded assembly for blitting pixels. That could be a bit less efficient when using this engine.

I would expect multi+GHz CPUs hardware to be able to overcome that, though, especially if you’re happy with the tiny (for today) screen resolution of Quake.

Quake also did a few hacks to stay performant (https://en.wikipedia.org/wiki/Quake_engine#Engine_design_and...).

If necessary you would have to do the same for something that uses this library.

Re: Olive.c: a simple graphics library that does not have any dependencies

#68
post #15

Nice! PortableGL is also great, OpenGL api that is defined in entirely in C and writes the “framebuffer” into an SDL window https://github.com/rswinkle/PortableGL

It's an implementation, not an API.

... and it is opengl-ish, namely seriously castrated (shaders). Borrowing maths from Mr. Bellard's tinygl.

Re: Olive.c: a simple graphics library that does not have any dependencies

#69

The combination of mapping pixels to memory and rendering individually and then that appearing on webgl and looking great on a not too expensive phone, where I am pinch zooming while it flawlessly animates, sort of blows my mind in how much technology has come in 25 years. Connects the old with the new in a way I haven’t seen for a while (and yeah seen loads of C64 emulators and such)

At first I thought the demos were gifs! After seeing your comment, I went back and remained slack-jawed!
Post reply on HN