gl.h 860 B

123456789101112131415161718192021222324252627282930313233343536373839
  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. /* OpenGL Test - Interface For GL Helper Functions */
  8. #ifndef GL_H
  9. #define GL_H
  10. #include <SDL.h>
  11. #ifndef __APPLE__
  12. #include <GL/glew.h>
  13. #include <GL/gl.h>
  14. #else
  15. #include <OpenGL/gl.h>
  16. static inline void glewInit(void) {}
  17. #endif
  18. typedef struct {
  19. int w, h;
  20. SDL_Window* window;
  21. SDL_GLContext glcontext;
  22. int is_fullscreen;
  23. } gl_ctx;
  24. void ortho(gl_ctx* ctx);
  25. void perspective(gl_ctx* ctx);
  26. void init_gl(gl_ctx* ctx, int w, int h);
  27. void draw_cube();
  28. GLuint compile_shader(const char* vertex, const char* fragment);
  29. void create_fbo(int eye_width, int eye_height, GLuint* fbo, GLuint* color_tex, GLuint* depth_tex);
  30. #endif