سؤال

I am trying to learn WebGL from absolutely no experience with OpenGL or OpenGL ES, and I am having a very difficult time trying to figure out what is happening behind every function call, more exactly what happens exactly with the GPU. I tried following some basic tutorials, and for it's purposes they work, but when I try to do some more complicated stuff in WebGL, I very often get weird problems. Like when I should link a shader, what happens when calling texImage2D twice for one texture etc.

I have searched high and low on the Internet, and the information is scarce at best, mainly because it is still under development and very few browsers support it yet. And if there isn't any complete documentation for it, is it similar enough to OpenGL ES to rely on that for reference?

هل كانت مفيدة؟

المحلول

WebGL and OpenGL ES 2.0 are very similar. Especially if you're just interested in figuring out what specific functions do, OpenGL ES and plain OpenGL documentation may give useful insights. Though, especially when looking at OpenGL documentation, keep in mind that some functionality may not be there, function signatures may be slightly different, etc.

Personally, I found Joe Groff's introduction to be very helpful. He goes into modern techniques from OpenGL 2.0, and does away with older functionality that OpenGL ES 2.0 and WebGL don't have any way and isn't really used much any more.

Other than that, I find the WebGL spec itself is actually a decent reference. It links to OpenGL ES 2.0 manual pages, and describes functions where they slightly differ.

I figure you already have some examples running, so you already know the basic procedure of setting things up. (Basically just: get context, set up viewport, compile shaders.) If not, there is a good set of tutorials on learningwebgl.com that deal specifically with WebGL. (Though, I found Joe Groff's introduction more informative on 3D and OpenGL concepts in general.)

The rest is just JavaScript. :)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top