Files
Linux-VR-Compositor-Dev/examples/opengl/gl.h
2018-09-20 19:57:49 +02:00

44 lines
974 B
C

/*
* OpenHMD - Free and Open Source API and drivers for immersive technology.
* Copyright (C) 2013 Fredrik Hultin.
* Copyright (C) 2013 Jakob Bornecrantz.
* Distributed under the Boost 1.0 licence, see LICENSE for full text.
*/
/* OpenGL Test - Interface For GL Helper Functions */
#ifndef GL_H
#define GL_H
#include <xcb/xcb.h>
#define GL_GLEXT_PROTOTYPES 1
#include <GL/gl.h>
#include <GL/glext.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
typedef struct {
int w, h;
xcb_connection_t* x_connection;
int x_screen;
xcb_window_t x_window;
EGLDisplay egl_display;
EGLConfig egl_config;
EGLContext egl_context;
EGLSurface egl_surface;
int is_fullscreen;
} gl_ctx;
void ortho(gl_ctx* ctx);
void perspective(gl_ctx* ctx);
void init_gl(gl_ctx* ctx, int w, int h);
void draw_cube();
GLuint compile_shader(const char* vertex, const char* fragment);
void create_fbo(int eye_width, int eye_height, GLuint* fbo, GLuint* color_tex, GLuint* depth_tex);
#endif