Skip to content

Commit

Permalink
build.sh up to 16
Browse files Browse the repository at this point in the history
  • Loading branch information
emeiri committed Oct 15, 2020
1 parent 32adeed commit 4aa8399
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 53 deletions.
9 changes: 9 additions & 0 deletions tutorial13/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

CC=g++
CPPFLAGS=`pkg-config --cflags glew ImageMagick freetype2 libglfw`
CPPFLAGS="$CPPFLAGS -I../Include -I../Common/FreetypeGL"
LDFLAGS=`pkg-config --libs glew ImageMagick freetype2 libglfw`
LDFLAGS="$LDFLAGS -lglut ../Lib/libAntTweakBar.a -lX11"

$CC tutorial13.cpp ../Common/ogldev_util.cpp ../Common/pipeline.cpp ../Common/math_3d.cpp ../Common/camera.cpp ../Common/ogldev_atb.cpp $CPPFLAGS $LDFLAGS -o tutorial13
25 changes: 13 additions & 12 deletions tutorial13/tutorial13.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright 2010 Etay Meiri
Copyright 2010 Etay Meiri
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -25,7 +25,8 @@
#include <GL/glew.h>
#include <GL/freeglut.h>

#include "../Common/ogldev_all.cpp"
#include "ogldev_pipeline.h"
#include "ogldev_math_3d.h"

#define WINDOW_WIDTH 1024
#define WINDOW_HEIGHT 768
Expand Down Expand Up @@ -87,9 +88,9 @@ static void CreateVertexBuffer()
Vertices[2] = Vector3f(1.0f, -1.0f, 0.5773f);
Vertices[3] = Vector3f(0.0f, 1.0f, 0.0f);

glGenBuffers(1, &VBO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);
glGenBuffers(1, &VBO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);
}

static void CreateIndexBuffer()
Expand Down Expand Up @@ -139,7 +140,7 @@ static void CompileShaders()
fprintf(stderr, "Error creating shader program\n");
exit(1);
}

string vs, fs;

if (!ReadFile(pVSFileName, vs)) {
Expand All @@ -158,11 +159,11 @@ static void CompileShaders()

glLinkProgram(ShaderProgram);
glGetProgramiv(ShaderProgram, GL_LINK_STATUS, &Success);
if (Success == 0) {
glGetProgramInfoLog(ShaderProgram, sizeof(ErrorLog), NULL, ErrorLog);
fprintf(stderr, "Error linking shader program: '%s'\n", ErrorLog);
if (Success == 0) {
glGetProgramInfoLog(ShaderProgram, sizeof(ErrorLog), NULL, ErrorLog);
fprintf(stderr, "Error linking shader program: '%s'\n", ErrorLog);
exit(1);
}
}

glValidateProgram(ShaderProgram);
glGetProgramiv(ShaderProgram, GL_VALIDATE_STATUS, &Success);
Expand Down Expand Up @@ -196,7 +197,7 @@ int main(int argc, char** argv)
fprintf(stderr, "Error: '%s'\n", glewGetErrorString(res));
return 1;
}

glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

CreateVertexBuffer();
Expand All @@ -209,7 +210,7 @@ int main(int argc, char** argv)
gPersProjInfo.Width = WINDOW_WIDTH;
gPersProjInfo.zNear = 1.0f;
gPersProjInfo.zFar = 100.0f;

glutMainLoop();

return 0;
Expand Down
9 changes: 9 additions & 0 deletions tutorial14/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

CC=g++
CPPFLAGS=`pkg-config --cflags glew ImageMagick freetype2 libglfw`
CPPFLAGS="$CPPFLAGS -I../Include -I../Common/FreetypeGL"
LDFLAGS=`pkg-config --libs glew ImageMagick freetype2 libglfw`
LDFLAGS="$LDFLAGS -lglut ../Lib/libAntTweakBar.a -lX11"

$CC tutorial14.cpp ../Common/ogldev_util.cpp ../Common/pipeline.cpp ../Common/math_3d.cpp ../Common/camera.cpp ../Common/ogldev_atb.cpp ../Common/glut_backend.cpp $CPPFLAGS $LDFLAGS -o tutorial14
27 changes: 15 additions & 12 deletions tutorial14/tutorial14.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright 2010 Etay Meiri
Copyright 2010 Etay Meiri
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -25,7 +25,10 @@
#include <GL/glew.h>
#include <GL/freeglut.h>

#include "../Common/ogldev_all.cpp"
#include "ogldev_pipeline.h"
#include "ogldev_math_3d.h"
#include "ogldev_glut_backend.h"


#define WINDOW_WIDTH 1024
#define WINDOW_HEIGHT 768
Expand Down Expand Up @@ -91,9 +94,9 @@ static void CreateVertexBuffer()
Vertices[2] = Vector3f(1.0f, -1.0f, 0.5773f);
Vertices[3] = Vector3f(0.0f, 1.0f, 0.0f);

glGenBuffers(1, &VBO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);
glGenBuffers(1, &VBO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);
}

static void CreateIndexBuffer()
Expand Down Expand Up @@ -143,7 +146,7 @@ static void CompileShaders()
fprintf(stderr, "Error creating shader program\n");
exit(1);
}

string vs, fs;

if (!ReadFile(pVSFileName, vs)) {
Expand All @@ -162,11 +165,11 @@ static void CompileShaders()

glLinkProgram(ShaderProgram);
glGetProgramiv(ShaderProgram, GL_LINK_STATUS, &Success);
if (Success == 0) {
glGetProgramInfoLog(ShaderProgram, sizeof(ErrorLog), NULL, ErrorLog);
fprintf(stderr, "Error linking shader program: '%s'\n", ErrorLog);
if (Success == 0) {
glGetProgramInfoLog(ShaderProgram, sizeof(ErrorLog), NULL, ErrorLog);
fprintf(stderr, "Error linking shader program: '%s'\n", ErrorLog);
exit(1);
}
}

glValidateProgram(ShaderProgram);
glGetProgramiv(ShaderProgram, GL_VALIDATE_STATUS, &Success);
Expand Down Expand Up @@ -200,7 +203,7 @@ int main(int argc, char** argv)
fprintf(stderr, "Error: '%s'\n", glewGetErrorString(res));
return 1;
}

glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

CreateVertexBuffer();
Expand All @@ -213,7 +216,7 @@ int main(int argc, char** argv)
gPersProjInfo.Width = WINDOW_WIDTH;
gPersProjInfo.zNear = 1.0f;
gPersProjInfo.zFar = 100.0f;

glutMainLoop();

return 0;
Expand Down
9 changes: 9 additions & 0 deletions tutorial15/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

CC=g++
CPPFLAGS=`pkg-config --cflags glew ImageMagick freetype2 libglfw`
CPPFLAGS="$CPPFLAGS -I../Include -I../Common/FreetypeGL"
LDFLAGS=`pkg-config --libs glew ImageMagick freetype2 libglfw`
LDFLAGS="$LDFLAGS -lglut ../Lib/libAntTweakBar.a -lX11"

$CC tutorial15.cpp ../Common/ogldev_util.cpp ../Common/pipeline.cpp ../Common/math_3d.cpp ../Common/camera.cpp ../Common/ogldev_atb.cpp ../Common/glut_backend.cpp $CPPFLAGS $LDFLAGS -o tutorial15
28 changes: 15 additions & 13 deletions tutorial15/tutorial15.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright 2010 Etay Meiri
Copyright 2010 Etay Meiri
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -25,7 +25,9 @@
#include <GL/glew.h>
#include <GL/freeglut.h>

#include "../Common/ogldev_all.cpp"
#include "ogldev_pipeline.h"
#include "ogldev_math_3d.h"
#include "ogldev_glut_backend.h"

#define WINDOW_WIDTH 1920
#define WINDOW_HEIGHT 1200
Expand Down Expand Up @@ -97,7 +99,7 @@ static void InitializeGlutCallbacks()
glutIdleFunc(_RenderSceneCB);
glutSpecialFunc(_SpecialKeyboardCB);
glutPassiveMotionFunc(_PassiveMouseCB);
glutKeyboardFunc(KeyboardCB);
glutKeyboardFunc(_KeyboardCB);
}

static void CreateVertexBuffer()
Expand All @@ -108,9 +110,9 @@ static void CreateVertexBuffer()
Vertices[2] = Vector3f(1.0f, -1.0f, 0.5773f);
Vertices[3] = Vector3f(0.0f, 1.0f, 0.0f);

glGenBuffers(1, &VBO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);
glGenBuffers(1, &VBO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);
}

static void CreateIndexBuffer()
Expand Down Expand Up @@ -160,7 +162,7 @@ static void CompileShaders()
fprintf(stderr, "Error creating shader program\n");
exit(1);
}

string vs, fs;

if (!ReadFile(pVSFileName, vs)) {
Expand All @@ -179,11 +181,11 @@ static void CompileShaders()

glLinkProgram(ShaderProgram);
glGetProgramiv(ShaderProgram, GL_LINK_STATUS, &Success);
if (Success == 0) {
glGetProgramInfoLog(ShaderProgram, sizeof(ErrorLog), NULL, ErrorLog);
fprintf(stderr, "Error linking shader program: '%s'\n", ErrorLog);
if (Success == 0) {
glGetProgramInfoLog(ShaderProgram, sizeof(ErrorLog), NULL, ErrorLog);
fprintf(stderr, "Error linking shader program: '%s'\n", ErrorLog);
exit(1);
}
}

glValidateProgram(ShaderProgram);
glGetProgramiv(ShaderProgram, GL_VALIDATE_STATUS, &Success);
Expand Down Expand Up @@ -219,7 +221,7 @@ int main(int argc, char** argv)
fprintf(stderr, "Error: '%s'\n", glewGetErrorString(res));
return 1;
}

glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

CreateVertexBuffer();
Expand All @@ -232,7 +234,7 @@ int main(int argc, char** argv)
gPersProjInfo.Width = WINDOW_WIDTH;
gPersProjInfo.zNear = 1.0f;
gPersProjInfo.zFar = 100.0f;

glutMainLoop();

return 0;
Expand Down
9 changes: 9 additions & 0 deletions tutorial16/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

CC=g++
CPPFLAGS=`pkg-config --cflags glew ImageMagick++ freetype2 libglfw`
CPPFLAGS="$CPPFLAGS -I../Include -I../Common/FreetypeGL"
LDFLAGS=`pkg-config --libs glew ImageMagick++ freetype2 libglfw`
LDFLAGS="$LDFLAGS -lglut ../Lib/libAntTweakBar.a -lX11"

$CC tutorial16.cpp ../Common/ogldev_util.cpp ../Common/pipeline.cpp ../Common/math_3d.cpp ../Common/camera.cpp ../Common/ogldev_atb.cpp ../Common/glut_backend.cpp ../Common/ogldev_texture.cpp $CPPFLAGS $LDFLAGS -o tutorial16
35 changes: 19 additions & 16 deletions tutorial16/tutorial16.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright 2011 Etay Meiri
Copyright 2011 Etay Meiri
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -25,12 +25,15 @@
#include <GL/glew.h>
#include <GL/freeglut.h>

#include "../Common/ogldev_all.cpp"
#include "ogldev_pipeline.h"
#include "ogldev_math_3d.h"
#include "ogldev_glut_backend.h"
#include "ogldev_texture.h"

#define WINDOW_WIDTH 1280
#define WINDOW_HEIGHT 1024

/*struct Vertex
struct Vertex
{
Vector3f m_pos;
Vector2f m_tex;
Expand All @@ -42,7 +45,7 @@
m_pos = pos;
m_tex = tex;
}
};*/
};


GLuint VBO;
Expand Down Expand Up @@ -128,10 +131,10 @@ static void CreateVertexBuffer()
Vertex(Vector3f(0.0f, -1.0f, -1.15475f), Vector2f(0.5f, 0.0f)),
Vertex(Vector3f(1.0f, -1.0f, 0.5773f), Vector2f(1.0f, 0.0f)),
Vertex(Vector3f(0.0f, 1.0f, 0.0f), Vector2f(0.5f, 1.0f)) };
glGenBuffers(1, &VBO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);

glGenBuffers(1, &VBO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);
}


Expand Down Expand Up @@ -184,7 +187,7 @@ static void CompileShaders()
fprintf(stderr, "Error creating shader program\n");
exit(1);
}

string vs, fs;

if (!ReadFile(pVSFileName, vs)) {
Expand All @@ -203,11 +206,11 @@ static void CompileShaders()

glLinkProgram(ShaderProgram);
glGetProgramiv(ShaderProgram, GL_LINK_STATUS, &Success);
if (Success == 0) {
glGetProgramInfoLog(ShaderProgram, sizeof(ErrorLog), NULL, ErrorLog);
fprintf(stderr, "Error linking shader program: '%s'\n", ErrorLog);
if (Success == 0) {
glGetProgramInfoLog(ShaderProgram, sizeof(ErrorLog), NULL, ErrorLog);
fprintf(stderr, "Error linking shader program: '%s'\n", ErrorLog);
exit(1);
}
}

glValidateProgram(ShaderProgram);
glGetProgramiv(ShaderProgram, GL_VALIDATE_STATUS, &Success);
Expand All @@ -228,7 +231,7 @@ static void CompileShaders()

int main(int argc, char** argv)
{
// Magick::InitializeMagick(*argv);
// Magick::InitializeMagick(*argv);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA);
glutInitWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT);
Expand Down Expand Up @@ -265,12 +268,12 @@ int main(int argc, char** argv)
if (!pTexture->Load()) {
return 1;
}

gPersProjInfo.FOV = 60.0f;
gPersProjInfo.Height = WINDOW_HEIGHT;
gPersProjInfo.Width = WINDOW_WIDTH;
gPersProjInfo.zNear = 1.0f;
gPersProjInfo.zFar = 100.0f;
gPersProjInfo.zFar = 100.0f;

glutMainLoop();

Expand Down
9 changes: 9 additions & 0 deletions tutorial17/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

CC=g++
CPPFLAGS=`pkg-config --cflags glew ImageMagick++ freetype2 libglfw fontconfig`
CPPFLAGS="$CPPFLAGS -I../Include -I../Common/FreetypeGL"
LDFLAGS=`pkg-config --libs glew ImageMagick++ freetype2 libglfw fontconfig`
LDFLAGS="$LDFLAGS -lglut ../Lib/libAntTweakBar.a -lX11 -L/usr/local/lib/freetype-gl-cpp -lfreetype-gl-cpp"

$CC tutorial17.cpp ../Common/ogldev_util.cpp ../Common/pipeline.cpp ../Common/math_3d.cpp ../Common/camera.cpp ../Common/ogldev_atb.cpp ../Common/glut_backend.cpp ../Common/ogldev_texture.cpp ../Common/ogldev_basic_lighting.cpp ../Common/technique.cpp ../Common/ogldev_app.cpp $CPPFLAGS $LDFLAGS -o tutorial17

0 comments on commit 4aa8399

Please sign in to comment.