Update README again
This commit is contained in:
57
README.md
57
README.md
@@ -1,6 +1,16 @@
|
|||||||
# Linux-VR-Compositor-Dev
|
# Linux-VR-Compositor-Dev
|
||||||
|
|
||||||
This is preview release ! (WIP)
|
Still experimental !
|
||||||
|
|
||||||
|
------------------------------
|
||||||
|
|
||||||
|
EGL 1.5 is required + 3 extensions :
|
||||||
|
- [EGL_MESA_drm_image](https://www.khronos.org/registry/EGL/extensions/MESA/EGL_MESA_drm_image.txt)
|
||||||
|
- [EGL_MESA_image_dma_buf_export](https://www.khronos.org/registry/EGL/extensions/MESA/EGL_MESA_image_dma_buf_export.txt)
|
||||||
|
- [EGL_EXT_image_dma_buf_import](https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import.txt)
|
||||||
|
|
||||||
|
No OpenGL version requirement, just one extension required :
|
||||||
|
- [OES_EGL_image](https://www.khronos.org/registry/OpenGL/extensions/OES/OES_EGL_image.txt)
|
||||||
|
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
@@ -8,15 +18,8 @@ NOTE :
|
|||||||
|
|
||||||
openglexample from [OpenHMD](https://github.com/OpenHMD/OpenHMD)
|
openglexample from [OpenHMD](https://github.com/OpenHMD/OpenHMD)
|
||||||
|
|
||||||
Currently requires 3 EGL extensions + 1 OpenGL extensions :
|
|
||||||
https://www.khronos.org/registry/EGL/extensions/MESA/EGL_MESA_drm_image.txt
|
|
||||||
https://www.khronos.org/registry/EGL/extensions/MESA/EGL_MESA_image_dma_buf_export.txt
|
|
||||||
https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import.txt
|
|
||||||
https://www.khronos.org/registry/OpenGL/extensions/OES/OES_EGL_image.txt
|
|
||||||
|
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
|
|
||||||
```C
|
```C
|
||||||
#define GL_GLEXT_PROTOTYPES
|
#define GL_GLEXT_PROTOTYPES
|
||||||
#include <GL/gl.h> // must include OpenGL before including the Linux VR Compositor header
|
#include <GL/gl.h> // must include OpenGL before including the Linux VR Compositor header
|
||||||
@@ -35,23 +38,22 @@ void main()
|
|||||||
struct lvrcInstance * compositor = lvrcCreateInstance(hmd);
|
struct lvrcInstance * compositor = lvrcCreateInstance(hmd);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize Linux VR Compositor SwapChain
|
// Initialize your OpenGL context using as usual
|
||||||
bool bSwapChainCreated = lvrcInitSwapChain(compositor);
|
// Note that only EGL is supported right now
|
||||||
|
EGLDisplay display = eglGetDisplay(...);
|
||||||
|
EGLContext context = eglCreateContext(display, ...);
|
||||||
|
EGLSurface surface = eglCreateWindowSurface(display, ...);
|
||||||
|
eglMakeCurrent(display, surface, surface, context);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialize HMD rendering
|
||||||
|
bool bRenderingInit = lvrcInitRenderingEGL(compositor, gl.egl_display, gl.egl_context, gl.egl_surface);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize OpenGL using EGL
|
// Initialize the Swap Chain (currently 2 textures)
|
||||||
// This is mostly as usual, the only change is that you must use the provided NativeDisplay/NativeWindow
|
GLuint textures [2];
|
||||||
EGLDisplay display = eglGetDisplay(lvrcSwapChainGetNativeDisplay(compositor));
|
bool bSwapChainCreated = lvrcInitSwapChain(compositor, width, height, textures);
|
||||||
EGLContext context = eglCreateContext(display, ...);
|
|
||||||
EGLSurface surface = eglCreateWindowSurface(display, lvrcSwapChainGetNativeWindow(compositor), ...);
|
|
||||||
|
|
||||||
eglMakeCurrent(display, surface, surface, >context);
|
|
||||||
|
|
||||||
//
|
|
||||||
// The compositor needs to create some resources that will be used during frame composition
|
|
||||||
// NOTE : the EGL context MUST be bound when calling this function
|
|
||||||
bool bCompositorInit = lvrcInitFrameResources(compositor);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Main Loop
|
// Main Loop
|
||||||
while (true)
|
while (true)
|
||||||
@@ -61,24 +63,19 @@ void main()
|
|||||||
lvrcBeginFrame(compositor);
|
lvrcBeginFrame(compositor);
|
||||||
|
|
||||||
... // Render to left & right textures as usual
|
... // Render to left & right textures as usual
|
||||||
|
|
||||||
lvrcSubmitFrameLeft(compositor, left_texture);
|
|
||||||
|
|
||||||
lvrcSubmitFrameRight(compositor, right_texture);
|
|
||||||
|
|
||||||
eglSwapBuffers(display, surface); // Swap buffers as usual
|
eglSwapBuffers(display, surface); // Swap buffers as usual
|
||||||
|
|
||||||
lvrcEndFrame(compositor);
|
lvrcEndFrame(compositor);
|
||||||
}
|
}
|
||||||
|
|
||||||
lvrcReleaseFrameResources(compositor);
|
lvrcReleaseSwapChain(compositor);
|
||||||
|
|
||||||
// You should destroy your EGL context here
|
// You should destroy your EGL context here
|
||||||
|
|
||||||
lvrcReleaseSwapChain(compositor);
|
|
||||||
|
|
||||||
lvrcDestroyInstance(compositor);
|
lvrcDestroyInstance(compositor);
|
||||||
|
|
||||||
ohmd_ctx_destroy(ctx);
|
ohmd_ctx_destroy(ctx);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user