build system 3
[henge/webcc.git] / src / henge / core / video.c
diff --git a/src/henge/core/video.c b/src/henge/core/video.c
new file mode 100644 (file)
index 0000000..2ddaaae
--- /dev/null
@@ -0,0 +1,38 @@
+/*!@file
+  \brief   core rendering support
+  \details initializes the SDL-based rendering target and context.
+  \author  Mihrtec
+  \date    2016
+----------------------------------------------------------------------------*/
+#include <glad/glad.h>
+#include <SDL2/SDL.h>
+#include <SDL2/SDL_image.h>
+#include <SDL2/SDL_ttf.h>
+
+#define ERROR_BUFFER_SIZE
+
+int          video_init(void);
+const char * video_get_error(void);
+void         video_quit(void);
+
+static char *video_error = 0;
+
+int
+video_init()
+{ if (!gladLoadGLLoader((GLADloadproc) SDL_GL_GetProcAddress))
+  { video_error = "Failed to initialize OpenGL context";
+    return -1;
+  }
+  printf("OGL %d.%d\n", GLVersion.major, GLVersion.minor);
+  return 0;
+}
+
+const char *
+video_get_error()
+{ return video_error;
+}
+
+void
+video_quit()
+{
+}