-1

Brainstorming a possible project I wanted to find out if it is possible to create/generate WebGL scene or object on server side to have it then rendered on client.

The reason is creating scene requires using c++ backend and I m looking for way to do so without porting code

Anycorn
  • 50,217
  • 42
  • 167
  • 261
  • You could do the C++ on your side, send it to PHP, which sends it to Javascript – Rojo Jan 11 '21 at 18:52
  • Node also has the ability to interact with C++ via [N-API](https://nodejs.org/api/addons.html), as does Python. – Zac Anger Jan 11 '21 at 18:54
  • It's my first attempt at JS as C++ person, I m bit lost in libraries and terms. Is Node JS able to do so without having c++ library on client? Client is not on same machine as server – Anycorn Jan 11 '21 at 19:07
  • Oh, yeah. If you just want to build the webgl binaries from C++ and have them served up for browsers, anything that has a server library would work: Node, Python, PHP, Ruby, C#, whatever, and just load it in client side as in [this question](https://stackoverflow.com/questions/4878145/javascript-and-webgl-external-scripts). – Zac Anger Jan 11 '21 at 19:39
  • There is no such thing as a :"webgl scene" or "webgl object". [WebGL is a rasterization API](https://webglfundamentals.org/webgl/lessons/webgl-2d-vs-3d-library.html). "Scenes" and "Objects" are a higher level concept implemented by you or some higher level library. Note: [You can run C++ in the browser](https://emscripten.org/) – gman Jan 12 '21 at 05:01
  • I have no experience in WebGl, terminology or API. What I was looking for is glTF. – Anycorn Jan 12 '21 at 07:24
  • glTF is certainly one 1000s of formats you could use but still, WebGL will not display a glTF file any more than GDI will display a PDF, you'll need a library of 100k+ lines code code like [three.js](https://threejs.org) or [babylon.js](https://www.babylonjs.com/) or [this viewer](https://github.com/KhronosGroup/glTF-Sample-Viewer) – gman Jan 12 '21 at 12:03

1 Answers1

-1

Looks like glTF is what I needed. As long as backend can serialize GL model, should be able to render it in browser

Anycorn
  • 50,217
  • 42
  • 167
  • 261