add missing files
This commit is contained in:
69
src/context.inl
Normal file
69
src/context.inl
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
#include <EGL/egl.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
static inline bool create_context(EGLenum platform, EGLNativeDisplayType nativeDisplay, EGLNativeWindowType nativeWindow, const EGLint * config_attribs, const EGLint * context_attribs, const EGLint * surface_attribs, EGLDisplay * outDisplay, EGLContext * outContext, EGLSurface * outSurface)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// get an EGL display connection
|
||||||
|
EGLDisplay display = eglGetPlatformDisplay(platform, nativeDisplay, (EGLAttrib*)0);
|
||||||
|
|
||||||
|
if (EGL_NO_DISPLAY == display)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// initialize the EGL display connection
|
||||||
|
EGLint major, minor;
|
||||||
|
|
||||||
|
if (!eglInitialize(display, &major, &minor))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// bind OpenGL API
|
||||||
|
eglBindAPI(EGL_OPENGL_API);
|
||||||
|
|
||||||
|
//
|
||||||
|
// get an appropriate EGL frame buffer configuration
|
||||||
|
EGLint num_config;
|
||||||
|
EGLConfig configs[128];
|
||||||
|
|
||||||
|
if (!eglChooseConfig(display, config_attribs, configs, 128, &num_config))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
EGLConfig config = configs[0]; // FIXME
|
||||||
|
|
||||||
|
//
|
||||||
|
// create context
|
||||||
|
EGLContext context = eglCreateContext(display, config, EGL_NO_CONTEXT, context_attribs);
|
||||||
|
|
||||||
|
if (EGL_NO_CONTEXT == context)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create Surface
|
||||||
|
EGLSurface surface = eglCreateWindowSurface(display, config, nativeWindow, surface_attribs);
|
||||||
|
if (EGL_NO_SURFACE == surface)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Set current context
|
||||||
|
if (!eglMakeCurrent(display, surface, surface, context))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
*outDisplay = display;
|
||||||
|
*outContext = context;
|
||||||
|
*outSurface = surface;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
0
src/context_EGL.c
Normal file
0
src/context_EGL.c
Normal file
0
src/context_EGL.h
Normal file
0
src/context_EGL.h
Normal file
1
src/rendering.c
Normal file
1
src/rendering.c
Normal file
@@ -0,0 +1 @@
|
|||||||
|
#include "rendering.h"
|
||||||
5
src/rendering.h
Normal file
5
src/rendering.h
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#ifndef LINUX_VR_COMPOSITOR_RENDERING_H
|
||||||
|
#define LINUX_VR_COMPOSITOR_RENDERING_H
|
||||||
|
|
||||||
|
|
||||||
|
#endif // LINUX_VR_COMPOSITOR_RENDERING_H
|
||||||
Reference in New Issue
Block a user