Closed trusktr closed 2 years ago
This is too awesome, but I really want it in WebGL. Maybe I'll try porting it at some point...
That would be cool. I don't know a thing about WebGL but let me know if I can advise on the code base.
On Jul 11, 2017, at 2:04 PM, Joseph Orbegoso Pea notifications@github.com wrote:
This is too awesome, but I really want it in WebGL. Maybe I'll try porting it at some point...
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
WebGL is very similar to OpenGL ES (well, it is written as a JavaScript interface for OpenGL ES). So many of the calls are very similar. For example, glTextImage2d()
would be gl.textImage2d()
in JavaScript, calling a method on the gl
context object.
In almost every case, whenever I see gl.someMethod
in JavaScript, I just look up glSomeMethod
to find OpenGL documentation on it. It is literally almost a one-to-one mapping, so porting to JavaScript wouldn't be difficult, just time consuming to rewrite.
f.e. glEnable(GL_DEPTH_TEST)
becomes gl.enable(gl.DEPTH_TEST)
. Almost everything maps one-to-one.
A big difference is that everything is easier in WebGL. For example, you can pass a reference to a <img />
HTML element into the gl.textImage2d()
call instead of a data array, and the webgl engine does the magic taking the data from the image element behind the scenes (though you can pass a Float32Array
too if you want. It has lot's of shortcuts like that that make the webgl coding experience easier.
It'd be nice to have something like this for WebGL.