Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to get webgl context in c++ node module like in emscripten? #8172

Open
hellozyemlya opened this issue Mar 10, 2024 · 2 comments
Labels

Comments

@hellozyemlya
Copy link

Question is simple - since nodejs and webpage executed in same context, is it possible to give an access to webgl context to a nodejs native module? So, for example, some other GL-based libraries can be easily reused?

@ayushmanchhabra
Copy link
Contributor

ayushmanchhabra commented Mar 19, 2024

Do you mean passing the WebGL context into a NW.js Node Addon?

index.html

<script>
const addon = require('./build/Release/addon');
const context = canvas.getContext('webgl');
addon(context);
</script>

@ayushmanchhabra
Copy link
Contributor

My C++ is not that great so was unable to get a working example. Maybe you could use this repo as a starting point:
https://github.com/nwutils/nw-node-addon-example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants