progs: Build samples dir with scons and glew.
authorJosé Fonseca <jfonseca@vmware.com>
Tue, 10 Feb 2009 20:27:49 +0000 (20:27 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Tue, 10 Feb 2009 20:28:08 +0000 (20:28 +0000)
progs/SConscript
progs/samples/Makefile
progs/samples/SConscript [new file with mode: 0644]
progs/samples/blendeq.c
progs/samples/blendxor.c

index 68a48b47287bbaddfc70c751f2b8ab039d63ab19..6484c761fc5b253876fe7b017e094b9c8fe56103 100644 (file)
@@ -1,7 +1,8 @@
 SConscript([
     'util/SConscript',
     'demos/SConscript',
-    'trivial/SConscript',
     'redbook/SConscript',
+    'samples/SConscript',
+    'trivial/SConscript',
     'vp/SConscript',
 ])
index 63dca07d2e851b19c51b97b1e06ac46ff5412ded..b300e38b9c203585094acc7bc4d40bffdf766345 100644 (file)
@@ -7,7 +7,7 @@ INCDIR = $(TOP)/include
 
 LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
 
-LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
+LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
 
 PROGS = accum bitmap1 bitmap2 blendeq blendxor copy cursor depth eval fog \
        font line logo nurb olympic overlay point prim quad select \
diff --git a/progs/samples/SConscript b/progs/samples/SConscript
new file mode 100644 (file)
index 0000000..7a8a0d6
--- /dev/null
@@ -0,0 +1,58 @@
+Import('*')
+
+if not env['GLUT']:
+    Return()
+
+env = env.Clone()
+
+env.Prepend(CPPPATH = [
+       '../util',
+])
+
+env.Prepend(LIBS = [
+       util,
+       '$GLUT_LIB'
+])
+
+if env['platform'] == 'windows':
+    env.Append(CPPDEFINES = ['NOMINMAX'])
+    env.Prepend(LIBS = ['winmm'])
+
+progs = [
+    'accum',
+    'bitmap1',
+    'bitmap2',
+    'blendeq',
+    'blendxor',
+    'copy',
+    'cursor',
+    'depth',
+    'eval',
+    'fog',
+    'font',
+    'line',
+    'logo',
+    'nurb',
+    #'oglinfo',
+    'olympic',
+    'overlay',
+    'point',
+    'prim',
+    'quad',
+    'rgbtoppm',
+    'select',
+    'shape',
+    'sphere',
+    'star',
+    'stencil',
+    'stretch',
+    'texture',
+    'tri',
+    'wave',
+]
+
+for prog in progs:
+    env.Program(
+        target = prog,
+        source = prog + '.c',
+    )
index d5143ecdf5c7491f1bac58986afa0a12fc5e6336..cd0474c5cea1da5b64885c2183b3d246dd6e254c 100644 (file)
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
-#ifdef _WIN32
-#include <windows.h>
-#endif
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
 
 GLenum doubleBuffer;
@@ -274,6 +271,8 @@ int main(int argc, char **argv)
        exit(1);
     }
 
+    glewInit();
+
     /* Make sure blend_logic_op extension is there. */
     s = (char *) glGetString(GL_EXTENSIONS);
     version = (char*) glGetString(GL_VERSION);
index 5bc4aa9bea47801aeb43469f9f30ed4c5156b844..057143651fdf088a0c7febbf77f48d544852046b 100644 (file)
 #include <unistd.h>
 #endif
 #include <stdlib.h>
-#ifdef _WIN32
-#include <windows.h>
-#endif
-#define GL_GLEXT_LEGACY
-#define GL_GLEXT_PROTOTYPES
+#include <GL/glew.h>
 #include <GL/glut.h>
-#include <GL/glext.h>
 
 
 GLenum doubleBuffer;
@@ -176,6 +171,8 @@ int main(int argc, char **argv)
        exit(1);
     }
 
+    glewInit();
+
     /* Make sure blend_logic_op extension is there. */
     s = (char *) glGetString(GL_EXTENSIONS);
     version = (char*) glGetString(GL_VERSION);