1 /* 2 * OpenHMD - Free and Open Source API and drivers for immersive technology. 3 * Copyright (C) 2013 Fredrik Hultin. 4 * Copyright (C) 2013 Jakob Bornecrantz. 5 * Distributed under the Boost 1.0 licence, see LICENSE for full text. 6 */ 7 8 /* OpenGL Test - Interface For GL Helper Functions */ 9 10 #ifndef GL_H 11 #define GL_H 12 13 #include <SDL.h> 14 15 #ifndef __APPLE__ 16 #include <GL/glew.h> 17 #include <GL/gl.h> 18 #else 19 #include <OpenGL/gl.h> glewInit(void)20static inline void glewInit(void) {} 21 #endif 22 23 typedef struct { 24 int w, h; 25 SDL_Window* window; 26 SDL_GLContext glcontext; 27 int is_fullscreen; 28 } gl_ctx; 29 30 void ortho(gl_ctx* ctx); 31 void perspective(gl_ctx* ctx); 32 void init_gl(gl_ctx* ctx, int w, int h); 33 void draw_cube(); 34 GLuint compile_shader(const char* vertex, const char* fragment); 35 void create_fbo(int eye_width, int eye_height, GLuint* fbo, GLuint* color_tex, GLuint* depth_tex); 36 37 38 #endif 39