sensics / OSVR-RenderManager

Apache License 2.0
63 stars 45 forks source link

Need: OpenGLES 2.0 shaders #198

Closed JeroMiya closed 7 years ago

JeroMiya commented 7 years ago

When running the latest RenderManager and calling OpenDisplay, I get this error:

08-26 13:49:38.057 12812-13021/com.osvr.android.gles2sample E/OSVR: Aug 26 13:49:38.059 error [RenderManager]: osvr::renderkit::RenderManager::RenderManagerOpenGL::checkShaderError: Empty error message from shader compiler.
08-26 13:50:30.717 12812-13021/com.osvr.android.gles2sample E/OSVR: Aug 26 13:50:30.719 error [RenderManager]: RenderManagerOpenGL::OpenDisplay: Could not construct vertex shader:
                                                                    0:1: P0007: Language version '330' unknown, this compiler only supports up to version '310 es'
                                                                    0:1: P0007: Unexpected text found after #version directive
                                                                    0:2: L0001: Typename expected, found 'layout'
                                                                    0:2: L0001: Expected identifier, found '('

The error occurs from attempting to compile the distortion shader, on this line: https://github.com/sensics/OSVR-RenderManager/blob/master/osvr/RenderKit/RenderManagerOpenGL.cpp#L637

I suspect if it was allowed to continue to attempt to compile the fragment shader, a similar error would occur with the fragment shader.

The distortion vertex and fragment shaders are defined here: https://github.com/sensics/OSVR-RenderManager/blob/master/osvr/RenderKit/RenderManagerOpenGL.cpp#L637

I think we need to create OpenGLES 2.0 compatible versions of these shaders and switch on OSVR_RM_USE_OPENGLES20 as to which set of shaders we use.

JeroMiya commented 7 years ago

Going to try and fix this myself. Stand by. :)

russell-taylor commented 7 years ago

Standing by. I don't know that we need shader version 3.3 for what we're doing, so you might try just dropping the version we ask for to 3.1. Need to make sure the shaders still work in that configuration, though.

russell-taylor commented 7 years ago

This looks like it is asking for 3.1 shaders, not 2.0; should that be good enough?

JeroMiya commented 7 years ago

It's only saying it supports ES 3 because my phone happens to support it, but most android phones in use out there don't support ES 3 right now, so we're still targeting ES2 at least as a baseline. I don't think it will actually compile an ES3 shader either, if the context is ES 2.

russell-taylor commented 7 years ago

I put in your GLSL version 1.0 shader in commit 49d55ce53de7b001c1510d92e4d8bf5e485423c4