WebGL for OpenGL course work?

Folks: We (http://sfcomplex.org) are creating an OpenGL class, sanctioned by the University of New Mexico. One idea we are considering is allowing the projects to use WebGL as well as OpenGL.

We are doing this for a couple of reasons. One is that the implementations are more easily managed: JavaScript within a browser. Another is that OpenGL ES and WebGL, are available on a wide variety of devices including phones and tablets.

Our main question is this: would any reasonable OpenGL homework problem we give be implementable in WebGL? I.e. would OpenGL and WebGL be equivalent to a reasonable approximation?

For example, one of the home work problems is to create an interactive Rubik’s Cube. The question is: would the implementation be quite similar in both OpenGL and WebGL?

Note that we want the course to be “modern” OpenGL, to be shader based … not using compatibility mode.

The main concern is that the students learn OpenGL syntax and semantics, but accepting WebGL as an alternative implementation environment.

WebGL is based on an OpenGL subset. So there are some parts of OpenGL that WebGL doesn’t implement.

However, assuming that you aren’t attempting to teach “fixed function pipeline” techniques (which are more or less entirely obsolete) - then I think that you’ll be able to teach it just fine using WebGL.

It would absolutely be possible to implement a Rubic’s cube in WebGL - that’s very easy.

There are a couple of things that are much easier in WebGL than OpenGL:

  • Loading textures from a web URL is extremely simple in WebGL - but OpenGL has no support for it at all - so you either have to write your own file loader or use some kind of 3rd party library.

  • In OpenGL, you generally have to go to some significant effort to interface to the underlying windowing system - again, OpenGL has no direct support for that, so you’re working with 3rd party libraries like GLUT/freeglut. With WebGL, it’s again, more or less a single function call.

So these things make life easier for someone learning WebGL than OpenGL - so you might want to explain that part at some point in the course, just so you have it covered.

But assuming you don’t care about those two things - and you don’t intend to teach the fixed-function pipeline, I think this is a great way to proceed.

– Steve

Can you, Steve or someone, please explain a bit what is meant by “With WebGL, it’s again, more or less a single function call.” That got me a bit confused. I’m not sure what Steve means.

Just FYI, we completed the class and WebGL worked out fine.

You can see the results at http://backspaces.net/CS591/ which has the three hw (home work) folders (this is my favorite: http://backspaces.net/CS591/hw2/hw2.html) and the final project (http://backspaces.net/CS591/netlogo/netlogo1.html)

The biggest problem is the lack of documentation. For the final project, which was an analysis of Agent Based Modeling using WebGL, I found I had to slowly build the system up from tiny models which explored each feature one at a time. This is the min/ directory.