-#include <math.h>
+#define GL_GLEXT_PROTOTYPES 1
+
+#include <stdio.h>
+#include <assert.h>
+#include <GL/gl.h>
+#include <GL/glext.h>
+
+#include <math.h>
#include "util.h"
void hsv2rgb(float h, float s, float v, float *r, float *g, float *b)
return std::string(buf, len);
}
+
+GLhandleARB compile_shader(const std::string &shader_src, GLenum type)
+{
+ GLhandleARB obj = glCreateShaderObjectARB(type);
+ const GLchar* source[] = { shader_src.data() };
+ const GLint length[] = { shader_src.size() };
+ glShaderSource(obj, 1, source, length);
+ glCompileShader(obj);
+
+ GLchar info_log[4096];
+ GLsizei log_length = sizeof(info_log) - 1;
+ glGetShaderInfoLog(obj, log_length, &log_length, info_log);
+ info_log[log_length] = 0;
+ printf("shader compile log: %s\n", info_log);
+
+ GLint status;
+ glGetShaderiv(obj, GL_COMPILE_STATUS, &status);
+ if (status == GL_FALSE) {
+ exit(1);
+ }
+
+ return obj;
+}
+