Can you think of any scenario at all where an OpenGL/WebGL context is best left softcoded?
I'm writing a 3D engine that could end up sticking around through a lot of projects, so I need to make sure it works perfectly.
define softcoded
>>57377712
Hardcoded: I define gl as a global variable, which I set during initialisation, and all functions I write assume that gl exists.
Softcoded: I define and set gl during intialisation, and pass gl into functions like in pic related.
>>57377634
Bump, curious about what /g/ thinks.
I don't think I'll need it softcoded, kind of a pain honestly, but I'm always up for opportunities to be able to do crazy things with my code.
>>57377634
>OpenGL/WebGL
I hope Vulkan and WebAssembly will kill this shit.
>>57379653
What's WebAssembly?
I've heard talk of why Vulkan will never become a web app, but if WebAssembly is close that'd be great.
>>57379660
Firefox:
about:config
javascript.options.wasm > true
Chome/Chromium:
chrome://flags#enable-webassembly
http://webassembly.org/
Have a fun.
P.S. Technically Vulkan support is possible but your browser(wasm) should provide(allow) access to it.
>>57380003
So I can write a Vulkan program then run it as a WASM one with only minimal changes?
The web isn't meant for your 3D shit, go write it in C instead.
>>57380037
Sure if write it in C/C++ and don't use unportable or forbidden API function.
>>57377744
Softcoded is usually more flexible to the changing requirements of different projects, but as a downside takes more time to implement and to get it right.
I'd probably just focus on getting the basic pipeline implemented, and then for each project you use it in "personalize" it to better suit the project requirements.
>>57380175
That was the most perfectly generic answer you could have possibly given.
What I'm looking at is not how hard it would be to softcode, what I'm looking at if there is even a single benefit to softcoding the gl context.
I've already got the gl context softcoded, but it makes the code a little cleaner if I hardcode it.
Although I can just avoid worrying about it for now because I can hardcode it just by adding a global variable and deleting every instance of "gl, " with text replacement.