summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle K <kylek389@gmail.com>2011-01-17 21:34:18 -0600
committerKamil Kaminski <kamilkss@gmail.com>2011-01-17 21:34:18 -0600
commit5736552c24e0c5c71caf6a914d30bb16ff0bcf7a (patch)
treea442501e75389e59b22ced21a8660ab7358f828d
parent163b963b1d6c1d0d288e27aeb978ff521a241917 (diff)
downloadGLPyramid++-5736552c24e0c5c71caf6a914d30bb16ff0bcf7a.tar.gz
GLPyramid++-5736552c24e0c5c71caf6a914d30bb16ff0bcf7a.tar.bz2
GLPyramid++-5736552c24e0c5c71caf6a914d30bb16ff0bcf7a.zip
initial mingw32 portHEADmaster
-rw-r--r--Makefile2
-rw-r--r--mingw3233
-rw-r--r--pyramid.cpp16
-rw-r--r--readme.txt21
4 files changed, 66 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 5da8212..fe1881c 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@ SDL_image_LDFLAGS := $(shell pkg-config --libs SDL_image)
$(PROG): $(OBJS)
$(CC) $(LDFLAGS) $(SDL_LDFLAGS) $(SDL_image_LDFLAGS) $(OBJS) -o $(PROG)
-
+
$(PROG).o: $(PROG).cpp
$(CC) -c $(CFLAGS) $(SDL_CFLAGS) $(SDL_image_CFLAGS) $(PROG).cpp
diff --git a/mingw32 b/mingw32
new file mode 100644
index 0000000..dda9868
--- /dev/null
+++ b/mingw32
@@ -0,0 +1,33 @@
+PROG = pyramid
+OBJS = $(PROG).o ./lib/math3d.o ./lib/gltools.o ./lib/TriangleMesh.o ./lib/VBOMesh.o
+CC = g++
+DBGFLAGS = -g -O0
+ifdef DEBUG
+ CFLAGS = $(DBGFLAGS) -Wall
+else
+ CFLAGS = -Wall -O2 -march=native -mtune=native
+endif
+LDFLAGS = -lglew32 -lopengl32 -lglu32 -lm -lfreeglut -lmingw32 -lsdlmain -lsdl -lsdl_image -mwindows
+
+$(PROG): $(OBJS)
+ $(CC) -o $(PROG) $(OBJS) $(LDFLAGS)
+
+$(PROG).o: $(PROG).cpp
+ $(CC) -c $(CFLAGS) $(PROG).cpp
+
+math3d.o: math3d.cpp
+ $(CC) -c $(CFLAGS) math3d.cpp
+
+gltools.o: gltools.cpp
+ $(CC) -c $(CFLAGS) ./lib/gltools.cpp
+
+TriangleMesh.o: TriangleMesh.cpp
+ $(CC) -c $(CFLAGS) ./lib/TriangleMesh.cpp
+
+VBOMesh.o: VBOMesh.cpp
+ $(CC) -c $(CFLAGS) ./lib/VBOMesh.cpp
+
+.PHONY: clean
+
+clean:
+ rm -f *.o ./$(PROG).exe ./lib/*.o
diff --git a/pyramid.cpp b/pyramid.cpp
index 76bf89e..dcb40c0 100644
--- a/pyramid.cpp
+++ b/pyramid.cpp
@@ -36,7 +36,7 @@ static void resize(int w, int h)
glLoadIdentity();
/* this needs to be ran again, glut does it for you I suppose */
- SDL_SetVideoMode(w, h, 32, SDL_OPENGL | SDL_GL_DOUBLEBUFFER | SDL_RESIZABLE);
+ SDL_SetVideoMode(w, h, 32, SDL_OPENGL | SDL_RESIZABLE);
}
static void SetupRC()
@@ -302,9 +302,15 @@ int main(int argc, char **argv)
}
atexit(SDL_Quit);
SDL_WM_SetCaption("Textured Pyramid", NULL);
-
- if ((screen = SDL_SetVideoMode(640, 480, 32, SDL_OPENGL | SDL_GL_DOUBLEBUFFER
- | SDL_RESIZABLE)) == NULL)
+
+ SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+ SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
+
+ if ((screen = SDL_SetVideoMode(640, 480, 32, SDL_OPENGL | SDL_RESIZABLE)) == NULL)
{
fprintf(stderr, "unable to set video mode: %s\n", SDL_GetError());
exit(-1);
@@ -359,7 +365,7 @@ int main(int argc, char **argv)
#ifdef STAT_FPS
deltaclock = SDL_GetTicks() - startclock;
if (deltaclock != 0 )
- current_fps = 1000 / deltaclock;
+ current_fps = 1000 / deltaclock;
static char buffer[30] = { 0 };
sprintf(buffer, "Textured Pyramid: %04d fps", current_fps);
diff --git a/readme.txt b/readme.txt
new file mode 100644
index 0000000..00f0c92
--- /dev/null
+++ b/readme.txt
@@ -0,0 +1,21 @@
+Compilation
+
+Windows XP:
+ Requirements:
+ - MinGW
+ - freeglut
+ - SDL
+ - SDL_image
+ - GLEW
+
+ $ make -f mingw32
+
+Linux:
+ Requirements:
+ - freeglut
+ - SDL
+ - SDL_image
+ - GLEW
+
+ $ make
+