| @@ -1,6 +1,7 @@ | |||
| SConscript([ | |||
| 'util/SConscript', | |||
| 'demos/SConscript', | |||
| 'glsl/SConscript', | |||
| 'redbook/SConscript', | |||
| 'samples/SConscript', | |||
| 'tests/SConscript', | |||
| @@ -0,0 +1,55 @@ | |||
| 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 = [ | |||
| 'array', | |||
| 'bitmap', | |||
| 'brick', | |||
| 'bump', | |||
| 'convolutions', | |||
| 'deriv', | |||
| 'fragcoord', | |||
| 'identity', | |||
| 'linktest', | |||
| 'mandelbrot', | |||
| 'multinoise', | |||
| 'multitex', | |||
| 'noise', | |||
| 'noise2', | |||
| 'pointcoord', | |||
| 'points', | |||
| 'samplers', | |||
| 'shadow_sampler', | |||
| 'skinning', | |||
| 'texaaline', | |||
| 'texdemo1', | |||
| 'toyball', | |||
| 'trirast', | |||
| 'twoside', | |||
| 'vert-or-frag-only', | |||
| 'vert-tex', | |||
| ] | |||
| for prog in progs: | |||
| env.Program( | |||
| target = prog, | |||
| source = prog + '.c', | |||
| ) | |||
| @@ -9,9 +9,9 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <math.h> | |||
| #include <GL/glew.h> | |||
| #include <GL/gl.h> | |||
| #include <GL/glut.h> | |||
| #include <GL/glext.h> | |||
| #include "extfuncs.h" | |||
| #include "shaderutil.h" | |||
| @@ -248,6 +248,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(500, 500); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); | |||
| win = glutCreateWindow(argv[0]); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(Key); | |||
| glutSpecialFunc(SpecialKey); | |||
| @@ -9,6 +9,7 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <math.h> | |||
| #include <GL/glew.h> | |||
| #include <GL/gl.h> | |||
| #include <GL/glut.h> | |||
| #include <GL/glext.h> | |||
| @@ -309,6 +310,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(WinWidth, WinHeight); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); | |||
| Win = glutCreateWindow(argv[0]); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(Key); | |||
| glutSpecialFunc(SpecialKey); | |||
| @@ -9,6 +9,7 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <math.h> | |||
| #include <GL/glew.h> | |||
| #include <GL/gl.h> | |||
| #include <GL/glut.h> | |||
| #include <GL/glext.h> | |||
| @@ -191,6 +192,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(400, 400); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); | |||
| win = glutCreateWindow(argv[0]); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(Key); | |||
| glutSpecialFunc(SpecialKey); | |||
| @@ -288,6 +288,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(400, 400); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); | |||
| win = glutCreateWindow(argv[0]); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(Key); | |||
| glutSpecialFunc(SpecialKey); | |||
| @@ -5,6 +5,8 @@ | |||
| * Author: Zack Rusin | |||
| */ | |||
| #include <GL/glew.h> | |||
| #define GL_GLEXT_PROTOTYPES | |||
| #include "readtex.h" | |||
| @@ -455,6 +457,7 @@ int main(int argc, char **argv) | |||
| exit(1); | |||
| } | |||
| glewInit(); | |||
| init(); | |||
| glutReshapeFunc(reshape); | |||
| @@ -13,6 +13,7 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <math.h> | |||
| #include <GL/glew.h> | |||
| #include <GL/gl.h> | |||
| #include <GL/glut.h> | |||
| #include <GL/glext.h> | |||
| @@ -228,6 +229,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(200, 200); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); | |||
| win = glutCreateWindow(argv[0]); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(Key); | |||
| glutSpecialFunc(SpecialKey); | |||
| @@ -12,6 +12,7 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <math.h> | |||
| #include <GL/glew.h> | |||
| #include <GL/gl.h> | |||
| #include <GL/glut.h> | |||
| #include <GL/glext.h> | |||
| @@ -174,6 +175,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(WinWidth, WinHeight); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); | |||
| win = glutCreateWindow(argv[0]); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(Key); | |||
| glutDisplayFunc(Redisplay); | |||
| @@ -9,6 +9,7 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <math.h> | |||
| #include <GL/glew.h> | |||
| #include <GL/gl.h> | |||
| #include <GL/glut.h> | |||
| #include <GL/glext.h> | |||
| @@ -195,6 +196,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(200, 200); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); | |||
| win = glutCreateWindow(argv[0]); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(Key); | |||
| glutSpecialFunc(SpecialKey); | |||
| @@ -9,6 +9,7 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <math.h> | |||
| #include <GL/glew.h> | |||
| #include <GL/gl.h> | |||
| #include <GL/glut.h> | |||
| #include <GL/glext.h> | |||
| @@ -245,6 +246,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(300, 300); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); | |||
| Win = glutCreateWindow(argv[0]); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(Key); | |||
| glutDisplayFunc(Redisplay); | |||
| @@ -9,6 +9,7 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <math.h> | |||
| #include <GL/glew.h> | |||
| #include <GL/gl.h> | |||
| #include <GL/glut.h> | |||
| #include <GL/glext.h> | |||
| @@ -206,6 +207,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(400, 400); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); | |||
| win = glutCreateWindow(argv[0]); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(Key); | |||
| glutSpecialFunc(SpecialKey); | |||
| @@ -8,6 +8,7 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <math.h> | |||
| #include <GL/glew.h> | |||
| #include <GL/gl.h> | |||
| #include <GL/glut.h> | |||
| #include <GL/glext.h> | |||
| @@ -270,6 +271,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(400, 400); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); | |||
| win = glutCreateWindow(argv[0]); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(Key); | |||
| glutSpecialFunc(SpecialKey); | |||
| @@ -28,6 +28,7 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <string.h> | |||
| #include <GL/glew.h> | |||
| #include "GL/glut.h" | |||
| #include "readtex.h" | |||
| #include "extfuncs.h" | |||
| @@ -400,6 +401,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(500, 400); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); | |||
| glutCreateWindow(Demo); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(key); | |||
| glutSpecialFunc(specialkey); | |||
| @@ -8,6 +8,7 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <math.h> | |||
| #include <GL/glew.h> | |||
| #include <GL/gl.h> | |||
| #include <GL/glut.h> | |||
| #include <GL/glext.h> | |||
| @@ -207,6 +208,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(400, 400); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); | |||
| win = glutCreateWindow(argv[0]); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(Key); | |||
| glutSpecialFunc(SpecialKey); | |||
| @@ -10,6 +10,7 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <math.h> | |||
| #include <GL/glew.h> | |||
| #include <GL/gl.h> | |||
| #include <GL/glut.h> | |||
| #include <GL/glext.h> | |||
| @@ -195,6 +196,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(WinWidth, WinHeight); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); | |||
| win = glutCreateWindow(argv[0]); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(Key); | |||
| glutDisplayFunc(Redisplay); | |||
| @@ -10,6 +10,7 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <math.h> | |||
| #include <GL/glew.h> | |||
| #include <GL/gl.h> | |||
| #include <GL/glut.h> | |||
| #include <GL/glext.h> | |||
| @@ -248,6 +249,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(WinWidth, WinHeight); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); | |||
| Win = glutCreateWindow(argv[0]); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(Key); | |||
| glutSpecialFunc(SpecialKey); | |||
| @@ -39,6 +39,7 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <string.h> | |||
| #include <GL/glew.h> | |||
| #include "GL/glut.h" | |||
| #include "readtex.h" | |||
| #include "extfuncs.h" | |||
| @@ -357,6 +358,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(500, 400); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); | |||
| glutCreateWindow(Demo); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(key); | |||
| glutSpecialFunc(specialkey); | |||
| @@ -10,6 +10,7 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <math.h> | |||
| #include <GL/glew.h> | |||
| #include <GL/gl.h> | |||
| #include <GL/glut.h> | |||
| #include <GL/glext.h> | |||
| @@ -329,6 +330,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(400, 300); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); | |||
| win = glutCreateWindow(argv[0]); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(Key); | |||
| glutDisplayFunc(Redisplay); | |||
| @@ -12,6 +12,7 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <math.h> | |||
| #include <GL/glew.h> | |||
| #include <GL/gl.h> | |||
| #include <GL/glut.h> | |||
| #include <GL/glext.h> | |||
| @@ -266,6 +267,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(500, 500); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); | |||
| win = glutCreateWindow(argv[0]); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(Key); | |||
| glutSpecialFunc(SpecialKey); | |||
| @@ -11,6 +11,7 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <math.h> | |||
| #include <GL/glew.h> | |||
| #include <GL/gl.h> | |||
| #include <GL/glut.h> | |||
| #include <GL/glext.h> | |||
| @@ -359,6 +360,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(WinWidth, WinHeight); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); | |||
| win = glutCreateWindow(argv[0]); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(Key); | |||
| glutDisplayFunc(Redisplay); | |||
| @@ -28,6 +28,7 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <string.h> | |||
| #include <GL/glew.h> | |||
| #include "GL/glut.h" | |||
| #include "readtex.h" | |||
| #include "extfuncs.h" | |||
| @@ -426,6 +427,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(500, 400); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); | |||
| win = glutCreateWindow(Demo); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(key); | |||
| glutSpecialFunc(specialkey); | |||
| @@ -9,6 +9,7 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <math.h> | |||
| #include <GL/glew.h> | |||
| #include <GL/gl.h> | |||
| #include <GL/glut.h> | |||
| #include <GL/glext.h> | |||
| @@ -212,6 +213,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(400, 400); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); | |||
| win = glutCreateWindow(argv[0]); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(Key); | |||
| glutSpecialFunc(SpecialKey); | |||
| @@ -15,6 +15,7 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <math.h> | |||
| #include <GL/glew.h> | |||
| #include <GL/gl.h> | |||
| #include <GL/glut.h> | |||
| #include <GL/glext.h> | |||
| @@ -247,6 +248,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(WinWidth, WinHeight); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); | |||
| win = glutCreateWindow(argv[0]); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(Key); | |||
| glutDisplayFunc(Redisplay); | |||
| @@ -12,6 +12,7 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <math.h> | |||
| #include <GL/glew.h> | |||
| #include <GL/gl.h> | |||
| #include <GL/glut.h> | |||
| #include <GL/glext.h> | |||
| @@ -293,6 +294,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(WinWidth, WinHeight); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); | |||
| win = glutCreateWindow(argv[0]); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(Key); | |||
| glutDisplayFunc(Redisplay); | |||
| @@ -11,6 +11,7 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <math.h> | |||
| #include <GL/glew.h> | |||
| #include <GL/gl.h> | |||
| #include <GL/glut.h> | |||
| #include <GL/glext.h> | |||
| @@ -181,6 +182,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(400, 200); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); | |||
| Win = glutCreateWindow(argv[0]); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(Key); | |||
| glutDisplayFunc(Redisplay); | |||
| @@ -9,6 +9,7 @@ | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <math.h> | |||
| #include <GL/glew.h> | |||
| #include <GL/gl.h> | |||
| #include <GL/glut.h> | |||
| #include <GL/glext.h> | |||
| @@ -266,6 +267,7 @@ main(int argc, char *argv[]) | |||
| glutInitWindowSize(500, 500); | |||
| glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); | |||
| win = glutCreateWindow(argv[0]); | |||
| glewInit(); | |||
| glutReshapeFunc(Reshape); | |||
| glutKeyboardFunc(Key); | |||
| glutSpecialFunc(SpecialKey); | |||
| @@ -40,10 +40,11 @@ def get_dxsdk_root(env): | |||
| except KeyError: | |||
| return None | |||
| def get_dxsdk_paths(env): | |||
| def generate(env): | |||
| dxsdk_root = get_dxsdk_root(env) | |||
| if dxsdk_root is None: | |||
| raise SCons.Errors.InternalError, "DirectX SDK not found" | |||
| # DirectX SDK not found | |||
| return | |||
| if env['machine'] in ('generic', 'x86'): | |||
| target_cpu = 'x86' | |||
| @@ -57,9 +58,6 @@ def get_dxsdk_paths(env): | |||
| env.Prepend(CPPPATH = [os.path.join(dxsdk_root, 'Include')]) | |||
| env.Prepend(LIBPATH = [os.path.join(dxsdk_root, 'Lib', target_cpu)]) | |||
| def generate(env): | |||
| get_dxsdk_paths(env) | |||
| def exists(env): | |||
| return get_dxsdk_root(env) is not None | |||
| @@ -325,8 +325,10 @@ def generate(env): | |||
| if gcc: | |||
| if debug: | |||
| ccflags += ['-O0', '-g3'] | |||
| elif env['toolchain'] == 'crossmingw': | |||
| ccflags += ['-O0', '-g3'] # mingw 4.2.1 optimizer is broken | |||
| elif env['CCVERSION'].startswith('4.2.'): | |||
| # gcc 4.2.x optimizer is broken | |||
| print "warning: gcc 4.2.x optimizer is broken -- disabling optimizations" | |||
| ccflags += ['-O0', '-g3'] | |||
| else: | |||
| ccflags += ['-O3', '-g3'] | |||
| if env['profile']: | |||
| @@ -449,11 +451,15 @@ def generate(env): | |||
| # Linker options | |||
| linkflags = [] | |||
| shlinkflags = [] | |||
| if gcc: | |||
| if env['machine'] == 'x86': | |||
| linkflags += ['-m32'] | |||
| if env['machine'] == 'x86_64': | |||
| linkflags += ['-m64'] | |||
| shlinkflags += [ | |||
| '-Wl,-Bsymbolic', | |||
| ] | |||
| if platform == 'windows' and msvc: | |||
| # See also: | |||
| # - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx | |||
| @@ -501,6 +507,7 @@ def generate(env): | |||
| '/entry:_DllMainCRTStartup', | |||
| ] | |||
| env.Append(LINKFLAGS = linkflags) | |||
| env.Append(SHLINKFLAGS = shlinkflags) | |||
| # Default libs | |||
| env.Append(LIBS = []) | |||