CFLAGS := -Wall -g -O1
-COMMON_SRC = gltest.cpp glwindow.cpp
+COMMON_SRC = gltest.cpp glwindow.cpp glutil.cpp
COMMON_HDR = glwindow.h glutil.h
COMMON_LD = -lX11 -lboost_program_options
--- /dev/null
+/* gltest - small OpenGL tearing test program
+ * Copyright (C) 2012-2013 Ralf Jung <post@ralfj.de>
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "glutil.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+static const char *glErrorToString(GLenum e)
+{
+#define CASE(name) case name: return #name
+ switch (e) {
+ CASE(GL_NO_ERROR);
+ CASE(GL_INVALID_ENUM);
+ CASE(GL_INVALID_VALUE);
+ CASE(GL_INVALID_OPERATION);
+#ifndef CON_GLES2
+ CASE(GL_STACK_OVERFLOW);
+ CASE(GL_STACK_UNDERFLOW);
+#endif
+ CASE(GL_OUT_OF_MEMORY);
+ default: return "<unknown>";
+ }
+#undef CASE
+}
+
+void checkGlError(const char *what)
+{
+ GLenum e = glGetError();
+ if (e == GL_NO_ERROR) return;
+ fprintf(stderr, "GL error %d (%s): %s\n", e, glErrorToString(e), what);
+ exit(1);
+}
void resolveFunctionPointers(T_glGetProcAddress p_glGetProcAddress);
/* The actual utility functions */
+void checkGlError(const char *what);
void initialise2dProjection();
void drawQuad(GLfloat red, GLfloat green, GLfloat blue, GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+#include "glutil.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <sstream>
-#include "glutil.h"
-
// extension functions we use
typedef GLuint (*GLCREATESHADERPROC) (GLenum type);
typedef void (*GLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
p_glDeleteBuffers = (GLDELETEBUFFERSPROC)resolveFunctionPointer(p_glGetProcAddress, "glDeleteBuffers");
}
-static const char *glErrorToString(GLenum e)
-{
-#define CASE(name) case name: return #name
- switch (e) {
- CASE(GL_NO_ERROR);
- CASE(GL_INVALID_ENUM);
- CASE(GL_INVALID_VALUE);
- CASE(GL_INVALID_OPERATION);
-#ifndef CON_GLES2
- CASE(GL_STACK_OVERFLOW);
- CASE(GL_STACK_UNDERFLOW);
-#endif
- CASE(GL_OUT_OF_MEMORY);
- default: return "<unknown>";
- }
-#undef CASE
-}
-
-static void checkGlError(const char *what)
-{
- GLenum e = glGetError();
- if (e == GL_NO_ERROR) return;
- fprintf(stderr, "GL error %d (%s): %s\n", e, glErrorToString(e), what);
- exit(1);
-}
-
// shaders
static const char *vertex_shader_source =
"#version 100 \n\