OpenGL 1.x ( + glu / glut ) was so convenient to learn graphics and to program quicky graphics applications !
With OpenGL 2 and more, and thus with webGL, ok you can now program fancy GPU shaders, but any simple program now need pages of initialisation, and all the convenient fonctionalities are now gone, far beside the glBegin/glVertex/glEnd immediate mode: lights, materials, matrices, flat shading mode, wireframe mode, keyboard and mouse events, menus, fonts, picking, pointSize, texture 1D, texGen, usual solid objects, display-lists...
Since no wrapper seemed to be available online (!), I wrote a lib for easy port of OpenGL1 programs to webGL, and have all these features back (even printf :-) ). Here it is, for your convenience.
( Disclaimer: it is a basic width-first implementation of features I needed for my demos, not at all a complete Mesa-like full implementation. Plus I was learning javascript and webGL in the process, so take it as a possibly useful base as it is ;-) . Plus it's yet under-tested and thus probably buggy. The demo themselve are old code from years 1999-2001: don't juge me, I was young :-) )Demos : (folder) 2D/3D fractals, minimal surface, mountains (simple), mountains (with particles and automatas), particles, colors in volume.
Lib: see folder/lib/, or tgz package. (webserver is to test your pages out of web using nodejs).
Guide of how to port your code to webGL using wOpenGL1.js .
BUG:on old chrome, firefox, opera, or on IE, Safari (see ECMA-262 compatibility ) you'll only get a blank page, since these don't implement back-quote strings `...` (so useful for multiline data such as shaders or help messages !). -> If you want to stick to these browsers+versions, you'll simply have to replace these (few) by a bunch of "...\n"+ at each line, once in cafe.html (help), twice in wOpenGL1.js (shaders), once in contextMenuCSS.js (or simply comment out its require in wOpenGL1.js if you don't use glut.menus)
Here is a fix for you: demo fractal-noBQ, lib wOpenGL1-noBQ.js.
Contact
E-mail :Adresse : Maverick / LJK -
INRIA ZIRST, 655 avenue de l'Europe
38330 Montbonnot Saint Martin - FRANCE
Fax : +33 (0)4 76 61 54 40 Secretariat :
76 61 54 26 (NB: I strongly prefer being contacted by email)