add openglexample from OpenHMD

This commit is contained in:
2018-09-18 20:18:47 +02:00
parent 21a2807143
commit a2d58a3d5f
6 changed files with 666 additions and 0 deletions

34
examples/opengl/gl.h Normal file
View File

@@ -0,0 +1,34 @@
/*
* 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
#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>
#include <GL/glext.h>
#include <lvrc.h>
typedef struct {
unsigned int w, h;
EGLDisplay display;
EGLSurface surface;
EGLContext context;
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 create_fbo(int eye_width, int eye_height, GLuint* fbo, GLuint* color_tex, GLuint* depth_tex);
#endif