progs: Get more samples building on windows.
diff --git a/progs/demos/SConscript b/progs/demos/SConscript
index 112da7b..bc166dd 100644
--- a/progs/demos/SConscript
+++ b/progs/demos/SConscript
@@ -1,11 +1,22 @@
-Import('env')
+Import('*')
 
 if not env['GLUT']:
     Return()
 
 env = env.Clone()
 
-env.Prepend(LIBS = ['$GLUT_LIB'])
+env.Prepend(CPPPATH = [
+	'../util',
+])
+
+env.Prepend(LIBS = [
+	util,
+	'$GLUT_LIB'
+])
+
+if env['platform'] == 'windows':
+    env.Append(CPPDEFINES = ['NOMINMAX'])
+    env.Prepend(LIBS = ['winmm'])
 
 progs = [
 	'arbfplight',
@@ -38,7 +49,6 @@
 	'multiarb',
 	'paltex',
 	'pointblast',
-	'rain',
 	'ray',
 	'readpix',
 	'reflect',
@@ -65,7 +75,15 @@
 ]
 
 for prog in progs:
-    prog = env.Program(
+    env.Program(
         target = prog,
         source = prog + '.c',
     )
+    
+env.Program(
+    target = 'rain',
+    source = [
+        'rain.cxx',
+        'particles.cxx',
+    ]
+)
diff --git a/progs/demos/fogcoord.c b/progs/demos/fogcoord.c
index 00c73c6..6f50993 100644
--- a/progs/demos/fogcoord.c
+++ b/progs/demos/fogcoord.c
@@ -7,19 +7,16 @@
  * Daniel Borca
  */
 
-#define GL_GLEXT_PROTOTYPES
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 #define DEPTH 5.0f
 
-static PFNGLFOGCOORDFEXTPROC glFogCoordf_ext;
 static PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointer_ext;
 
-static GLboolean have_fog_coord;
-
 static GLfloat camz;
 
 static GLint fogMode;
@@ -45,10 +42,11 @@
 }
 
 
-static void APIENTRY
-glFogCoordf_nop (GLfloat f)
+static void
+glFogCoordf_ext (GLfloat f)
 {
-   (void)f;
+   if (fogCoord)
+      glFogCoordfEXT(f);
 }
 
 
@@ -120,14 +118,11 @@
 static GLboolean
 SetFogCoord(GLboolean fogCoord)
 {
-   glFogCoordf_ext = glFogCoordf_nop;
-
-   if (!have_fog_coord) {
+   if (!GLEW_EXT_fog_coord) {
       return GL_FALSE;
    }
 
    if (fogCoord) {
-      glFogCoordf_ext = (PFNGLFOGCOORDFEXTPROC)glutGetProcAddress("glFogCoordfEXT");
       glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
    }
    else {
@@ -340,7 +335,7 @@
          SetFogMode(fogMode);
          break;
       case 'c':
-         fogCoord = SetFogCoord(fogCoord ^ GL_TRUE);
+	 fogCoord = SetFogCoord(fogCoord ^ GL_TRUE);
          break;
       case 't':
          Texture = !Texture;
@@ -372,8 +367,7 @@
 
    printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
 
-   have_fog_coord = glutExtensionSupported("GL_EXT_fog_coord");
-   if (!have_fog_coord) {
+   if (!GLEW_EXT_fog_coord) {
       printf("GL_EXT_fog_coord not supported!\n");
    }
 
@@ -400,10 +394,9 @@
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    glTexCoordPointer(2, GL_FLOAT, 0, texcoord_pointer);
 
-   if (have_fog_coord) {
-      glFogCoordPointer_ext = (PFNGLFOGCOORDPOINTEREXTPROC)glutGetProcAddress("glFogCoordPointerEXT");
+   if (GLEW_EXT_fog_coord) {
       glEnableClientState(GL_FOG_COORDINATE_ARRAY_EXT);
-      glFogCoordPointer_ext(GL_FLOAT, 0, fogcoord_pointer);
+      glFogCoordPointerEXT(GL_FLOAT, 0, fogcoord_pointer);
    }
 
    Reset();
@@ -417,6 +410,7 @@
    glutInitWindowSize( 600, 600 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    glutCreateWindow(argv[0]);
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
diff --git a/progs/demos/gloss.c b/progs/demos/gloss.c
index 9974f0d..b2126e3 100644
--- a/progs/demos/gloss.c
+++ b/progs/demos/gloss.c
@@ -22,6 +22,7 @@
 #include <stdlib.h>
 #include <math.h>
 #include <string.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 #include "readtex.h"
@@ -438,6 +439,7 @@
    glutInitWindowSize(WinWidth, WinHeight);
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
    glutCreateWindow(argv[0] );
+   glewInit();
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );
diff --git a/progs/demos/multiarb.c b/progs/demos/multiarb.c
index 451fd11..85c4e3a 100644
--- a/progs/demos/multiarb.c
+++ b/progs/demos/multiarb.c
@@ -14,6 +14,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 #include "readtex.h"
@@ -326,6 +327,7 @@
    glutInitWindowPosition( 0, 0 );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
    glutCreateWindow(argv[0] );
+   glewInit();
 
    Init( argc, argv );
 
diff --git a/progs/demos/rain.cxx b/progs/demos/rain.cxx
index 59b6471..265d90c 100644
--- a/progs/demos/rain.cxx
+++ b/progs/demos/rain.cxx
@@ -24,8 +24,6 @@
 #ifdef _WIN32
 #include <windows.h>
 #include <mmsystem.h>
-#include "particles.cxx"
-#include "readtex.c"
 #endif
 
 #ifdef XMESA
diff --git a/progs/demos/stex3d.c b/progs/demos/stex3d.c
index 83ae368..c0bbea0 100644
--- a/progs/demos/stex3d.c
+++ b/progs/demos/stex3d.c
@@ -18,7 +18,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
-#include <GL/gl.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 
@@ -662,6 +662,8 @@
       exit(0);
    }
 
+   glewInit();
+
    init();
 
    printHelp();
diff --git a/progs/demos/winpos.c b/progs/demos/winpos.c
index b58e330..13a9c7e 100644
--- a/progs/demos/winpos.c
+++ b/progs/demos/winpos.c
@@ -11,7 +11,7 @@
 #ifdef _WIN32
 #include <windows.h>
 #endif
-#define GL_GLEXT_PROTOTYPES
+#include "GL/glew.h"
 #include "GL/glut.h"
 
 #include "readtex.h"
@@ -29,8 +29,7 @@
 static int ImgWidth, ImgHeight;
 static GLenum ImgFormat;
 
-typedef void (APIENTRY * PFNWINDOWPOSFUNC)(GLfloat x, GLfloat y);
-static PFNWINDOWPOSFUNC WindowPosFunc;
+static PFNGLWINDOWPOS2FPROC WindowPosFunc;
 
 static void draw( void )
 {
@@ -71,19 +70,16 @@
 
 static void init( void )
 {
-#ifdef GL_ARB_window_pos
-   if (glutExtensionSupported("GL_ARB_window_pos")) {
+   if (GLEW_ARB_window_pos) {
       printf("Using GL_ARB_window_pos\n");
-      WindowPosFunc = &glWindowPos2fARB;
+      WindowPosFunc = glWindowPos2fARB;
    }
    else
-#elif defined(GL_MESA_window_pos)
-   if (glutExtensionSupported("GL_MESA_window_pos")) {
+   if (GLEW_MESA_window_pos) {
       printf("Using GL_MESA_window_pos\n");
-      WindowPosFunc = &glWindowPos2fMESA;
+      WindowPosFunc = glWindowPos2fMESA;
    }
    else
-#endif
    {
       printf("Sorry, GL_ARB/MESA_window_pos extension not available.\n");
       exit(1);
@@ -109,6 +105,8 @@
       exit(0);
    }
 
+   glewInit();
+
    init();
 
    glutReshapeFunc( reshape );