diff --git a/README.md b/README.md index 1e8cd6a..7bd71c6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,16 @@ # 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) -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 #define GL_GLEXT_PROTOTYPES #include // must include OpenGL before including the Linux VR Compositor header @@ -35,23 +38,22 @@ void main() struct lvrcInstance * compositor = lvrcCreateInstance(hmd); // - // Initialize Linux VR Compositor SwapChain - bool bSwapChainCreated = lvrcInitSwapChain(compositor); + // Initialize your OpenGL context using as usual + // 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 - // This is mostly as usual, the only change is that you must use the provided NativeDisplay/NativeWindow - EGLDisplay display = eglGetDisplay(lvrcSwapChainGetNativeDisplay(compositor)); - 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); - + // Initialize the Swap Chain (currently 2 textures) + GLuint textures [2]; + bool bSwapChainCreated = lvrcInitSwapChain(compositor, width, height, textures); + // // Main Loop while (true) @@ -61,24 +63,19 @@ void main() lvrcBeginFrame(compositor); ... // Render to left & right textures as usual - - lvrcSubmitFrameLeft(compositor, left_texture); - - lvrcSubmitFrameRight(compositor, right_texture); eglSwapBuffers(display, surface); // Swap buffers as usual lvrcEndFrame(compositor); } - lvrcReleaseFrameResources(compositor); + lvrcReleaseSwapChain(compositor); // You should destroy your EGL context here - lvrcReleaseSwapChain(compositor); - lvrcDestroyInstance(compositor); ohmd_ctx_destroy(ctx); } ``` +