TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

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

499 点作者 masterofsome超过 2 年前

23 条评论

billsix超过 2 年前
Nice! PortableGL is also great, OpenGL api that is defined in entirely in C and writes the “framebuffer” into an SDL window<p><a href="https:&#x2F;&#x2F;github.com&#x2F;rswinkle&#x2F;PortableGL" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rswinkle&#x2F;PortableGL</a>
评论 #32944576 未加载
评论 #32935912 未加载
dezmou超过 2 年前
Nice to see tsoding on the top of HN, this guy does amazing streams and youtube video
评论 #32934601 未加载
评论 #32938683 未加载
评论 #32942729 未加载
评论 #32935653 未加载
quickthrower2超过 2 年前
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)
评论 #32938412 未加载
评论 #32938109 未加载
an1sotropy超过 2 年前
The TODO section at the end of olive.c shows that there&#x27;s lots more to do, and decisions to make about how much to do (e.g. what about bezier curves?), but that&#x27;s quibbling: it is refreshing (and educational) to see everything here done in such a perfectly self-contained way. Godspeed!
评论 #32938984 未加载
osener超过 2 年前
I also found this Cairo-like vector graphics library that runs in a shader interesting: <a href="https:&#x2F;&#x2F;www.shadertoy.com&#x2F;view&#x2F;lslXW8" rel="nofollow">https:&#x2F;&#x2F;www.shadertoy.com&#x2F;view&#x2F;lslXW8</a>
评论 #32942761 未加载
tleb_超过 2 年前
Idea for improvement: avoiding color blending in sRGB. A first step would be to work in linear space.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;tsoding&#x2F;olive.c&#x2F;blob&#x2F;43a67dd76760f915516a5e8e2529ec46dcdf1f22&#x2F;olive.c#L270-L287" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tsoding&#x2F;olive.c&#x2F;blob&#x2F;43a67dd76760f915516a...</a>
two_almonds超过 2 年前
<i>The name is pronounced as &quot;olivets&quot; which is a Ukrainian word for &quot;pencil&quot; (&quot;олівець&quot;).</i><p>From the readme.
评论 #32936699 未加载
altilunium超过 2 年前
Years ago, i made something similar as a coursework (Computer Graphics)<p><a href="https:&#x2F;&#x2F;github.com&#x2F;rtnF14&#x2F;ComputerGraphics" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rtnF14&#x2F;ComputerGraphics</a>
treuks超过 2 年前
Please do note that it is in an extremely early stage of development, so if it may seem raw and unpolished, it is because it is.
dlivingston超过 2 年前
Cool project! What’s the motivation? Since it eschews any graphics API, is it safe to assume this only does CPU-based rendering?
评论 #32933369 未加载
评论 #32935303 未加载
simonw超过 2 年前
This is so nice. It feels a bit like Logo using C syntax - I love that it&#x27;s totally safe to run software written in this in a browser thanks to WebAssembly.
WoodenChair超过 2 年前
I started something superficially similar but for SVG in an intro C class: <a href="https:&#x2F;&#x2F;github.com&#x2F;davecom&#x2F;SuperSimpleGraphics" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;davecom&#x2F;SuperSimpleGraphics</a>
TheMode超过 2 年前
Looks great but the API itself doesn&#x27;t seem very innovative (which is probably not the goal anyway).<p>I&#x27;d personally be interested in a graphics API that do not try to render the whole buffer every frame, but update it given a list of changes (e.g. sprite moving&#x2F;rotating). I believe that such approach could work very well for a 2D software renderer given the likeliness of spatial redundancy, and possibly for video encoding without going through a clueless encoder querying pixels (and having the ability to exploit hardware efficiency to decode&#x2F;render the stream).
m00dy超过 2 年前
I have been wondering what he is going to do under the recently declared partial mobilisation. I hope he could find a way to get out the country. He needs to know he is always welcomed in Turkiye.
erwincoumans超过 2 年前
Cool use of Webassemly! See also the 500 line <a href="https:&#x2F;&#x2F;github.com&#x2F;ssloy&#x2F;tinyrenderer" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ssloy&#x2F;tinyrenderer</a> or the 100 line Python&#x2F;numpy version <a href="https:&#x2F;&#x2F;github.com&#x2F;rougier&#x2F;tiny-renderer" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rougier&#x2F;tiny-renderer</a><p>Both cpu renderers with texture mapping and Wavefront obj import without further dependencies.
andai超过 2 年前
Does this use WebGL2? It doesn&#x27;t run on my phone (which does support WebGL 1).<p>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!<p><a href="https:&#x2F;&#x2F;github.com&#x2F;tsoding&#x2F;olive.c&#x2F;blob&#x2F;master&#x2F;js&#x2F;vc.js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tsoding&#x2F;olive.c&#x2F;blob&#x2F;master&#x2F;js&#x2F;vc.js</a>
评论 #32937267 未加载
评论 #32936067 未加载
评论 #32934739 未加载
TazeTSchnitzel超过 2 年前
It&#x27;s cool that you can get away with software rendering these days, but it&#x27;s a shame to not make use of the power of the GPU.
评论 #32938186 未加载
ofrzeta超过 2 年前
From the build.sh I figured out that all it takes is to compile with the wasm target, I think:<p>clang $COMMON_CFLAGS -Os -fno-builtin --target=wasm32 ...
synergy20超过 2 年前
this is very impressive, how is this done? the executable is only a few hundred KB and it runs for me, wasm is doing the magic here but I don&#x27;t know too much about how the process works.<p>I added -I&#x2F;usr&#x2F;include&#x2F;SDL2 to build.sh, made sure wasm-ld is in place, and it builds and runs smoothly.
评论 #32934144 未加载
arriu超过 2 年前
Any plans for text rendering?
评论 #32934703 未加载
tambourine_man超过 2 年前
Amazing that software rendering can be this smooth on a phone.
bearon超过 2 年前
Nice! An awesome retrospective.
jandrese超过 2 年前
It pains me to see #include &lt;olive.c&gt; at the top of the file. It makes the project feel like a toy.
评论 #32933384 未加载
评论 #32933363 未加载
评论 #32938210 未加载
评论 #32934565 未加载