A WebGL2 widget for Jupyter Lab
This module is exposing a part of the WebGL2 context. Is is assumed that you are familiar with the concepts and commands. You can find more information about it here : https://webgl2fundamentals.org/
There is some major differences still :
gl.drawArrays(...)
in JavaScript becomes widget.draw_arrays(...)
in Pythongl.clear(gl.DEPTH_BUFFER_BIT | gl.COLOR_BUFFER_BIT);
in JavaScript becomes widget.clear(depth_buffer_bit=True, color_buffer_bit=True)
in Pythongl.bufferData(gl.ARRAY_BUFFER, data, gl.DYNAMIC_DRAW);
in JavaScript becomes widget.buffer_data("ARRAY_BUFFER", data, "DYNAMIC_DRAW")
in Pythoncreate_vertex_array_ext
that will create and link the programs and buffers all at once.Not all the functions are exposed as of today. If you need more, feel free to ask on github https://github.com/JeromeEippers/ipywebgl.
All the commands you call on the GLViewer are push to a commands buffer. That commands buffer is only flushed when you call the execute_commands() method.
You can install using pip
:
pip install ipywebgl