Update openglexample

This commit is contained in:
2018-09-20 19:57:49 +02:00
parent 5ca8a6311f
commit 2d1c914ca1
6 changed files with 593 additions and 226 deletions

View File

@@ -10,24 +10,33 @@
#ifndef GL_H
#define GL_H
#define GL_GLEXT_PROTOTYPES
#include <xcb/xcb.h>
#define GL_GLEXT_PROTOTYPES 1
#include <GL/gl.h>
#include <GL/glext.h>
#include <lvrc.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
typedef struct {
unsigned int w, h;
EGLDisplay display;
EGLSurface surface;
EGLContext context;
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, struct lvrcInstance * compositor);
void draw_cube(void);
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);