vrheights
changeset 2:b49461618f61
starting point
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 25 Sep 2014 11:44:45 +0300 |
parents | d06e4e24f922 |
children | 316ec8250af2 |
files | .hgignore src/game.cc src/game.h src/main.cc src/opengl.cc src/opengl.h |
diffstat | 6 files changed, 378 insertions(+), 226 deletions(-) [+] |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/.hgignore Thu Sep 25 11:44:45 2014 +0300 1.3 @@ -0,0 +1,10 @@ 1.4 +\.o$ 1.5 +\.d$ 1.6 +\.swp$ 1.7 +Makefile$ 1.8 +^vrheights$ 1.9 +^Debug 1.10 +^Release 1.11 +\.suo$ 1.12 +\.opensdf$ 1.13 +\.sdf$
2.1 --- a/src/game.cc Wed Sep 24 11:34:07 2014 +0300 2.2 +++ b/src/game.cc Thu Sep 25 11:44:45 2014 +0300 2.3 @@ -1,101 +1,204 @@ 2.4 -#include <stdio.h> 2.5 -#include <assert.h> 2.6 -#include <algorithm> 2.7 -#include "opengl.h" 2.8 -#include "game.h" 2.9 -#include "goatvr.h" 2.10 - 2.11 -static void create_rtarg(int x, int y); 2.12 -static int next_pow2(int x); 2.13 - 2.14 -static int win_width, win_height; 2.15 -static unsigned int fb_tex; 2.16 -static unsigned int fbo, fb_depth; 2.17 -static int fb_xsz, fb_ysz; 2.18 -static int fb_tex_xsz, fb_tex_ysz; 2.19 - 2.20 -bool game_init() 2.21 -{ 2.22 - init_opengl(); 2.23 - 2.24 - if(vr_init() == -1) { 2.25 - return false; 2.26 - } 2.27 - 2.28 - glEnable(GL_DEPTH_TEST); 2.29 - glEnable(GL_CULL_FACE); 2.30 - 2.31 - int sdk_fb_xsz = vr_getf(VR_LEYE_XRES) + vr_getf(VR_REYE_XRES); 2.32 - int sdk_fb_ysz = std::max(vr_getf(VR_LEYE_YRES), vr_getf(VR_REYE_YRES)); 2.33 - create_rtarg(sdk_fb_xsz, sdk_fb_ysz); 2.34 - 2.35 - return true; 2.36 -} 2.37 - 2.38 -void game_cleanup() 2.39 -{ 2.40 - vr_shutdown(); 2.41 -} 2.42 - 2.43 -void game_update(long tm) 2.44 -{ 2.45 -} 2.46 - 2.47 -void game_display() 2.48 -{ 2.49 -} 2.50 - 2.51 -void game_reshape(int x, int y) 2.52 -{ 2.53 -} 2.54 - 2.55 -void game_keyboard(int key, bool pressed); 2.56 -void game_mouse_button(int bn, bool state, int x, int y); 2.57 -void game_mouse_motion(int x, int y); 2.58 - 2.59 - 2.60 -static void create_rtarg(int x, int y) 2.61 -{ 2.62 - if(x == fb_xsz && y == fb_ysz) { 2.63 - return; // nothing changed 2.64 - } 2.65 - 2.66 - fb_xsz = x; 2.67 - fb_ysz = y; 2.68 - fb_tex_xsz = next_pow2(fb_xsz); 2.69 - fb_tex_ysz = next_pow2(fb_ysz); 2.70 - 2.71 - if(!fbo) { 2.72 - glGenFramebuffers(1, &fbo); 2.73 - 2.74 - glGenTextures(1, &fb_tex); 2.75 - glBindTexture(GL_TEXTURE_2D, fb_tex); 2.76 - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 2.77 - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 2.78 - 2.79 - glGenRenderbuffers(1, &fb_depth); 2.80 - } 2.81 - 2.82 - glBindFramebuffer(GL_FRAMEBUFFER, fbo); 2.83 - 2.84 - glBindTexture(GL_TEXTURE_2D, fb_tex); 2.85 - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, fb_tex_xsz, fb_tex_ysz, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 2.86 - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fb_tex, 0); 2.87 - 2.88 - glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, fb_tex_xsz, fb_tex_ysz); 2.89 - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, fb_depth); 2.90 - 2.91 - assert(glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE); 2.92 - glBindFramebuffer(GL_FRAMEBUFFER, 0); 2.93 -} 2.94 - 2.95 -static int next_pow2(int x) 2.96 -{ 2.97 - x -= 1; 2.98 - x |= x >> 1; 2.99 - x |= x >> 2; 2.100 - x |= x >> 4; 2.101 - x |= x >> 8; 2.102 - x |= x >> 16; 2.103 - return x + 1; 2.104 -} 2.105 +#include <stdio.h> 2.106 +#include <assert.h> 2.107 +#include <algorithm> 2.108 +#include "opengl.h" 2.109 +#include "game.h" 2.110 +#include "goatvr.h" 2.111 + 2.112 +static void draw_scene(); 2.113 +static void toggle_hmd_fullscr(); 2.114 +static void create_rtarg(int x, int y); 2.115 +static int next_pow2(int x); 2.116 + 2.117 +static int win_width, win_height; 2.118 +static unsigned int fb_tex; 2.119 +static unsigned int fbo, fb_depth; 2.120 +static int fb_xsz, fb_ysz; 2.121 +static int fb_tex_xsz, fb_tex_ysz; 2.122 + 2.123 +bool game_init() 2.124 +{ 2.125 + init_opengl(); 2.126 + 2.127 + if(vr_init() == -1) { 2.128 + return false; 2.129 + } 2.130 + 2.131 + glEnable(GL_DEPTH_TEST); 2.132 + glEnable(GL_CULL_FACE); 2.133 + 2.134 + return true; 2.135 +} 2.136 + 2.137 +void game_cleanup() 2.138 +{ 2.139 + vr_shutdown(); 2.140 +} 2.141 + 2.142 +void game_update(long tm) 2.143 +{ 2.144 +} 2.145 + 2.146 +void game_display() 2.147 +{ 2.148 + glBindFramebuffer(GL_FRAMEBUFFER, fbo); 2.149 + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 2.150 + 2.151 + for(int i=0; i<2; i++) { 2.152 + glViewport(i == 0 ? 0 : fb_xsz / 2, 0, fb_xsz / 2, fb_ysz); 2.153 + vr_begin(i); 2.154 + 2.155 + float proj[16]; 2.156 + if(vr_proj_matrix(i, 0.5, 500.0, proj)) { 2.157 + glMatrixMode(GL_PROJECTION); 2.158 + glLoadMatrixf(proj); 2.159 + } 2.160 + 2.161 + glMatrixMode(GL_MODELVIEW); 2.162 + 2.163 + float view[16]; 2.164 + vr_view_matrix(i, view); 2.165 + glLoadMatrixf(view); 2.166 + /* move the camera to the eye level of the user */ 2.167 + glTranslatef(0, -vr_getf_def(VR_EYE_HEIGHT, 1.65), 0); 2.168 + 2.169 + draw_scene(); 2.170 + 2.171 + vr_end(); 2.172 + } 2.173 + 2.174 + glBindFramebuffer(GL_FRAMEBUFFER, 0); 2.175 + glViewport(0, 0, win_width, win_height); 2.176 + 2.177 + vr_swap_buffers(); 2.178 + assert(glGetError() == GL_NO_ERROR); 2.179 +} 2.180 + 2.181 +void game_reshape(int x, int y) 2.182 +{ 2.183 + win_width = x; 2.184 + win_height = y; 2.185 + 2.186 + create_rtarg(vr_geti_def(VR_RENDER_XRES, x), vr_geti_def(VR_RENDER_YRES, y)); 2.187 + vr_output_texture(fb_tex, 0, 0, (float)fb_xsz / (float)fb_tex_xsz, (float)fb_ysz / (float)fb_tex_ysz); 2.188 + 2.189 + /* these might be overriden in VR mode (see game_display) */ 2.190 + glViewport(0, 0, x, y); 2.191 + glMatrixMode(GL_PROJECTION); 2.192 + glLoadIdentity(); 2.193 + gluPerspective(50.0, (float)x / (float)y, 0.5, 500.0); 2.194 +} 2.195 + 2.196 +void game_keyboard(int key, bool pressed) 2.197 +{ 2.198 + if(pressed) { 2.199 + switch(key) { 2.200 + case 27: 2.201 + exit_game(); 2.202 + break; 2.203 + 2.204 + case 'f': 2.205 + toggle_hmd_fullscr(); 2.206 + break; 2.207 + 2.208 + case 'r': 2.209 + vr_recenter(); 2.210 + break; 2.211 + 2.212 + default: 2.213 + break; 2.214 + } 2.215 + } 2.216 +} 2.217 + 2.218 +void game_mouse_button(int bn, bool state, int x, int y) 2.219 +{ 2.220 +} 2.221 + 2.222 +void game_mouse_motion(int x, int y) 2.223 +{ 2.224 +} 2.225 + 2.226 +static void draw_scene() 2.227 +{ 2.228 +} 2.229 + 2.230 +static void toggle_hmd_fullscr() 2.231 +{ 2.232 + static bool fullscr; 2.233 + static int prev_x, prev_y; 2.234 + //static int prev_xsz, prev_ysz; 2.235 + 2.236 + fullscr = !fullscr; 2.237 + if(fullscr) { 2.238 + /* entering fullscreen on the HMD */ 2.239 + int xoffs = vr_geti_def(VR_WIN_XOFFS, -1); 2.240 + int yoffs = vr_geti_def(VR_WIN_YOFFS, -1); 2.241 + if(xoffs != -1) { 2.242 + get_window_pos(&prev_x, &prev_y); 2.243 + move_window(xoffs, yoffs); 2.244 + } 2.245 + 2.246 + int xsz = vr_geti_def(VR_DISPLAY_WIDTH, -1); 2.247 + int ysz = vr_geti_def(VR_DISPLAY_HEIGHT, -1); 2.248 + if(xsz != -1) { 2.249 + //prev_xsz = win_width; 2.250 + //prev_ysz = win_height; 2.251 + resize_window(xsz, ysz); 2.252 + } 2.253 + enter_fullscreen(); 2.254 + 2.255 + } else { 2.256 + /* leaving fullscreen */ 2.257 + leave_fullscreen(); 2.258 + /*move_window(prev_x, prev_y); 2.259 + resize_window(prev_xsz, prev_ysz);*/ 2.260 + } 2.261 +} 2.262 + 2.263 +static void create_rtarg(int x, int y) 2.264 +{ 2.265 + if(x == fb_xsz && y == fb_ysz) { 2.266 + return; // nothing changed 2.267 + } 2.268 + 2.269 + fb_xsz = x; 2.270 + fb_ysz = y; 2.271 + fb_tex_xsz = next_pow2(fb_xsz); 2.272 + fb_tex_ysz = next_pow2(fb_ysz); 2.273 + 2.274 + if(!fbo) { 2.275 + glGenFramebuffers(1, &fbo); 2.276 + 2.277 + glGenTextures(1, &fb_tex); 2.278 + glBindTexture(GL_TEXTURE_2D, fb_tex); 2.279 + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 2.280 + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 2.281 + 2.282 + glGenRenderbuffers(1, &fb_depth); 2.283 + } 2.284 + 2.285 + glBindFramebuffer(GL_FRAMEBUFFER, fbo); 2.286 + 2.287 + glBindTexture(GL_TEXTURE_2D, fb_tex); 2.288 + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, fb_tex_xsz, fb_tex_ysz, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); 2.289 + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fb_tex, 0); 2.290 + 2.291 + glBindRenderbuffer(GL_RENDERBUFFER, fb_depth); 2.292 + glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, fb_tex_xsz, fb_tex_ysz); 2.293 + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, fb_depth); 2.294 + 2.295 + assert(glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE); 2.296 + glBindFramebuffer(GL_FRAMEBUFFER, 0); 2.297 +} 2.298 + 2.299 +static int next_pow2(int x) 2.300 +{ 2.301 + x -= 1; 2.302 + x |= x >> 1; 2.303 + x |= x >> 2; 2.304 + x |= x >> 4; 2.305 + x |= x >> 8; 2.306 + x |= x >> 16; 2.307 + return x + 1; 2.308 +}
3.1 --- a/src/game.h Wed Sep 24 11:34:07 2014 +0300 3.2 +++ b/src/game.h Thu Sep 25 11:44:45 2014 +0300 3.3 @@ -1,16 +1,22 @@ 3.4 -#ifndef GAME_H_ 3.5 -#define GAME_H_ 3.6 - 3.7 -bool game_init(); 3.8 -void game_cleanup(); 3.9 - 3.10 -void game_update(long tm); 3.11 -void game_display(); 3.12 -void game_reshape(int x, int y); 3.13 -void game_keyboard(int key, bool pressed); 3.14 -void game_mouse_button(int bn, bool state, int x, int y); 3.15 -void game_mouse_motion(int x, int y); 3.16 - 3.17 -void exit_game(); /* defined in main.cc */ 3.18 - 3.19 -#endif /* GAME_H_ */ 3.20 \ No newline at end of file 3.21 +#ifndef GAME_H_ 3.22 +#define GAME_H_ 3.23 + 3.24 +bool game_init(); 3.25 +void game_cleanup(); 3.26 + 3.27 +void game_update(long tm); 3.28 +void game_display(); 3.29 +void game_reshape(int x, int y); 3.30 +void game_keyboard(int key, bool pressed); 3.31 +void game_mouse_button(int bn, bool state, int x, int y); 3.32 +void game_mouse_motion(int x, int y); 3.33 + 3.34 +/* defined in main.cc */ 3.35 +void exit_game(); 3.36 +void move_window(int x, int y); 3.37 +void resize_window(int x, int y); 3.38 +void get_window_pos(int *x, int *y); 3.39 +void enter_fullscreen(); 3.40 +void leave_fullscreen(); 3.41 + 3.42 +#endif /* GAME_H_ */
4.1 --- a/src/main.cc Wed Sep 24 11:34:07 2014 +0300 4.2 +++ b/src/main.cc Thu Sep 25 11:44:45 2014 +0300 4.3 @@ -1,94 +1,127 @@ 4.4 -#include <stdio.h> 4.5 -#include <stdlib.h> 4.6 -#include <SDL2/SDL.h> 4.7 -#include "game.h" 4.8 - 4.9 -static bool init(); 4.10 -static void cleanup(); 4.11 -static void handle_event(SDL_Event *ev); 4.12 - 4.13 -static bool done; 4.14 -static SDL_Window *win; 4.15 -static SDL_GLContext ctx; 4.16 - 4.17 -int main(int argc, char **argv) 4.18 -{ 4.19 - if(!init()) { 4.20 - return 1; 4.21 - } 4.22 - 4.23 - for(;;) { 4.24 - SDL_Event ev; 4.25 - while(SDL_PollEvent(&ev)) { 4.26 - handle_event(&ev); 4.27 - if(done) break; 4.28 - } 4.29 - 4.30 - game_update(SDL_GetTicks()); 4.31 - game_display(); 4.32 - } 4.33 - 4.34 - cleanup(); 4.35 - return 0; 4.36 -} 4.37 - 4.38 -void exit_game() 4.39 -{ 4.40 - done = true; 4.41 -} 4.42 - 4.43 -static bool init() 4.44 -{ 4.45 - if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) == -1) { 4.46 - fprintf(stderr, "failed to initialize SDL\n"); 4.47 - return false; 4.48 - } 4.49 - 4.50 - win = SDL_CreateWindow("vrheights", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 4.51 - 1280, 800, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE); 4.52 - if(!win) { 4.53 - fprintf(stderr, "failed to create window\n"); 4.54 - return false; 4.55 - } 4.56 - 4.57 - if(!(ctx = SDL_GL_CreateContext(win))) { 4.58 - fprintf(stderr, "failed to create OpenGL context\n"); 4.59 - return false; 4.60 - } 4.61 - 4.62 - return game_init(); 4.63 -} 4.64 - 4.65 -static void cleanup() 4.66 -{ 4.67 - game_cleanup(); 4.68 - SDL_Quit(); 4.69 -} 4.70 - 4.71 -static void handle_event(SDL_Event *ev) 4.72 -{ 4.73 - switch(ev->type) { 4.74 - case SDL_WINDOWEVENT: 4.75 - if(ev->window.event == SDL_WINDOWEVENT_RESIZED) { 4.76 - game_reshape(ev->window.data1, ev->window.data2); 4.77 - } 4.78 - break; 4.79 - 4.80 - case SDL_KEYDOWN: 4.81 - case SDL_KEYUP: 4.82 - game_keyboard(ev->key.keysym.sym, ev->key.state == SDL_PRESSED); 4.83 - break; 4.84 - 4.85 - case SDL_MOUSEBUTTONDOWN: 4.86 - case SDL_MOUSEBUTTONUP: 4.87 - game_mouse_button(ev->button.button, ev->button.state == SDL_PRESSED, ev->button.x, ev->button.y); 4.88 - break; 4.89 - 4.90 - case SDL_MOUSEMOTION: 4.91 - game_mouse_motion(ev->motion.x, ev->motion.y); 4.92 - break; 4.93 - 4.94 - default: 4.95 - break; 4.96 - } 4.97 -} 4.98 \ No newline at end of file 4.99 +#include <stdio.h> 4.100 +#include <stdlib.h> 4.101 +#include <SDL2/SDL.h> 4.102 +#include "game.h" 4.103 + 4.104 +static bool init(); 4.105 +static void cleanup(); 4.106 +static void handle_event(SDL_Event *ev); 4.107 + 4.108 +static bool done; 4.109 +static SDL_Window *win; 4.110 +static SDL_GLContext ctx; 4.111 + 4.112 +int main(int argc, char **argv) 4.113 +{ 4.114 + if(!init()) { 4.115 + return 1; 4.116 + } 4.117 + 4.118 + while(!done) { 4.119 + SDL_Event ev; 4.120 + while(SDL_PollEvent(&ev)) { 4.121 + handle_event(&ev); 4.122 + if(done) goto end_main_loop; 4.123 + } 4.124 + 4.125 + game_update(SDL_GetTicks()); 4.126 + game_display(); 4.127 + } 4.128 + 4.129 +end_main_loop: 4.130 + cleanup(); 4.131 + return 0; 4.132 +} 4.133 + 4.134 +void exit_game() 4.135 +{ 4.136 + done = true; 4.137 +} 4.138 + 4.139 +void move_window(int x, int y) 4.140 +{ 4.141 + SDL_SetWindowPosition(win, x, y); 4.142 +} 4.143 + 4.144 +void get_window_pos(int *x, int *y) 4.145 +{ 4.146 + SDL_GetWindowPosition(win, x, y); 4.147 +} 4.148 + 4.149 +void resize_window(int x, int y) 4.150 +{ 4.151 + SDL_SetWindowSize(win, x, y); 4.152 +} 4.153 + 4.154 +void enter_fullscreen() 4.155 +{ 4.156 + SDL_SetWindowFullscreen(win, SDL_WINDOW_FULLSCREEN_DESKTOP); 4.157 +} 4.158 + 4.159 +void leave_fullscreen() 4.160 +{ 4.161 + SDL_SetWindowFullscreen(win, 0); 4.162 +} 4.163 + 4.164 +static bool init() 4.165 +{ 4.166 + if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) == -1) { 4.167 + fprintf(stderr, "failed to initialize SDL\n"); 4.168 + return false; 4.169 + } 4.170 + 4.171 + win = SDL_CreateWindow("vrheights", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 4.172 + 1280, 800, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE); 4.173 + if(!win) { 4.174 + fprintf(stderr, "failed to create window\n"); 4.175 + return false; 4.176 + } 4.177 + 4.178 + if(!(ctx = SDL_GL_CreateContext(win))) { 4.179 + fprintf(stderr, "failed to create OpenGL context\n"); 4.180 + return false; 4.181 + } 4.182 + 4.183 + if(!game_init()) { 4.184 + return false; 4.185 + } 4.186 + 4.187 + int w, h; 4.188 + SDL_GetWindowSize(win, &w, &h); 4.189 + game_reshape(w, h); 4.190 + return true; 4.191 +} 4.192 + 4.193 +static void cleanup() 4.194 +{ 4.195 + game_cleanup(); 4.196 + SDL_Quit(); 4.197 +} 4.198 + 4.199 +static void handle_event(SDL_Event *ev) 4.200 +{ 4.201 + switch(ev->type) { 4.202 + case SDL_WINDOWEVENT: 4.203 + if(ev->window.event == SDL_WINDOWEVENT_RESIZED) { 4.204 + game_reshape(ev->window.data1, ev->window.data2); 4.205 + } 4.206 + break; 4.207 + 4.208 + case SDL_KEYDOWN: 4.209 + case SDL_KEYUP: 4.210 + game_keyboard(ev->key.keysym.sym, ev->key.state == SDL_PRESSED); 4.211 + break; 4.212 + 4.213 + case SDL_MOUSEBUTTONDOWN: 4.214 + case SDL_MOUSEBUTTONUP: 4.215 + game_mouse_button(ev->button.button, ev->button.state == SDL_PRESSED, ev->button.x, ev->button.y); 4.216 + break; 4.217 + 4.218 + case SDL_MOUSEMOTION: 4.219 + game_mouse_motion(ev->motion.x, ev->motion.y); 4.220 + break; 4.221 + 4.222 + default: 4.223 + break; 4.224 + } 4.225 +}
5.1 --- a/src/opengl.cc Wed Sep 24 11:34:07 2014 +0300 5.2 +++ b/src/opengl.cc Thu Sep 25 11:44:45 2014 +0300 5.3 @@ -1,7 +1,7 @@ 5.4 -#include "opengl.h" 5.5 - 5.6 -bool init_opengl() 5.7 -{ 5.8 - glewInit(); 5.9 - return true; 5.10 -} 5.11 \ No newline at end of file 5.12 +#include "opengl.h" 5.13 + 5.14 +bool init_opengl() 5.15 +{ 5.16 + glewInit(); 5.17 + return true; 5.18 +}
6.1 --- a/src/opengl.h Wed Sep 24 11:34:07 2014 +0300 6.2 +++ b/src/opengl.h Thu Sep 25 11:44:45 2014 +0300 6.3 @@ -1,8 +1,8 @@ 6.4 -#ifndef OPENGL_H_ 6.5 -#define OPENGL_H_ 6.6 - 6.7 -#include <GL/glew.h> 6.8 - 6.9 -bool init_opengl(); 6.10 - 6.11 -#endif /* OPENGL_H_ */ 6.12 \ No newline at end of file 6.13 +#ifndef OPENGL_H_ 6.14 +#define OPENGL_H_ 6.15 + 6.16 +#include <GL/glew.h> 6.17 + 6.18 +bool init_opengl(); 6.19 + 6.20 +#endif /* OPENGL_H_ */