summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile8
-rw-r--r--wimmel_gl.c29
2 files changed, 20 insertions, 17 deletions
diff --git a/Makefile b/Makefile
index 3ebb15c..0156d6c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
CC = gcc
-CFLAGS = -ggdb -std=c99 -pedantic -Wall \
+CFLAGS = -ggdb -std=c99 -pedantic -Wall $(DEFINES) \
$(shell pkg-config --cflags gdk-pixbuf-2.0 glib-2.0 gthread-2.0) \
-DN_THREADS=$(shell grep -c ^processor /proc/cpuinfo || echo 2)
-LDFLAGS = -lm \
+LDFLAGS = $(LIBS) -lm \
$(shell pkg-config --libs gdk-pixbuf-2.0 glib-2.0 gthread-2.0)
PROGS = wimmel wimmel_gl
@@ -23,9 +23,7 @@ wimmel_gl: wimmel_gl.o util.o
wimmel_gl:
- $(CC) `pkg-config --cflags --libs gtk+-2.0 glib-2.0 egl gl` -o $@ $+
-
-
+ $(CC) $(LDFLAGS) `pkg-config --cflags --libs egl gl` -o $@ $+
clean:
rm -f $(PROGS) $(OBJS)
diff --git a/wimmel_gl.c b/wimmel_gl.c
index 2d33edb..26e20af 100644
--- a/wimmel_gl.c
+++ b/wimmel_gl.c
@@ -3,10 +3,11 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#define GL_GLEXT_PROTOTYPES
-#if 0
-#include <GL/glut.h>
-#else
+
+#ifndef GLUT
#include <EGL/egl.h>
+#else
+#include <GL/glut.h>
#endif
#include <GL/gl.h>
@@ -14,7 +15,9 @@
#include "util.h"
+#ifndef GLUT
EGLDisplay dpy;
+#endif
GLuint vbo;
GLint proj_uniform, tex_uniform, tex2_uniform, pixelsize_uniform,
search_rect_uniform, barrier_uniform;
@@ -211,16 +214,10 @@ draw(void)
}
static void
-init_gl(void)
+init_gl(int argc, char **argv)
{
GLuint fb, rb;
-#if 0
- glutInit(&argc, argv);
- glutInitDisplayMode(GLUT_RGBA /*| GLUT_DEPTH */ | GLUT_DOUBLE);
- glutInitWindowSize(1,1);
- int window = glutCreateWindow("wimmel");
- glutDestroyWindow(window);
-#else
+#ifndef GLUT
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(dpy, NULL, NULL);
eglBindAPI(EGL_OPENGL_API);
@@ -234,6 +231,12 @@ init_gl(void)
fprintf(stderr, "failed to make context current\n");
exit(EXIT_FAILURE);
}
+#else
+ glutInit(&argc, argv);
+ glutInitDisplayMode(GLUT_RGBA /*| GLUT_DEPTH */ | GLUT_DOUBLE);
+ glutInitWindowSize(1,1);
+ int window = glutCreateWindow("wimmel");
+ glutDestroyWindow(window);
#endif
glGenFramebuffersEXT(1, &fb);
glGenRenderbuffersEXT(1, &rb);
@@ -275,7 +278,7 @@ main(int argc, char **argv)
width = gdk_pixbuf_get_width(pixbuf);
height = gdk_pixbuf_get_height(pixbuf);
- init_gl();
+ init_gl(argc, argv);
x1 = atoi(argv[2]);
y1 = atoi(argv[3]);
@@ -323,7 +326,9 @@ main(int argc, char **argv)
free(buffer);
g_object_unref(pixbuf);
+#ifndef GLUT
eglTerminate(dpy);
+#endif
return 0;
}