mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:03:53 +02:00
Merge pull request #7279 from jherico/osx_gl_fix
Bypass baffling OSX GL error
This commit is contained in:
commit
fc98408922
4 changed files with 15 additions and 23 deletions
|
@ -293,14 +293,12 @@ void OpenGLDisplayPlugin::customizeContext() {
|
|||
auto uniforms = _program->ActiveUniforms();
|
||||
while (!uniforms.Empty()) {
|
||||
auto uniform = uniforms.Front();
|
||||
if (uniform.Name() == "Projection") {
|
||||
_projectionUniform = uniform.Index();
|
||||
} else if (uniform.Name() == "ModelView") {
|
||||
_modelViewUniform = uniform.Index();
|
||||
if (uniform.Name() == "mvp") {
|
||||
_mvpUniform = uniform.Index();
|
||||
}
|
||||
uniforms.Next();
|
||||
}
|
||||
|
||||
|
||||
_plane = loadPlane(_program);
|
||||
|
||||
_compositeFramebuffer = std::make_shared<BasicFramebufferWrapper>();
|
||||
|
@ -410,16 +408,14 @@ void OpenGLDisplayPlugin::compositeOverlay() {
|
|||
using namespace oglplus;
|
||||
// Overlay draw
|
||||
if (isStereo()) {
|
||||
Uniform<glm::mat4>(*_program, _projectionUniform).Set(mat4());
|
||||
Uniform<glm::mat4>(*_program, _modelViewUniform).Set(mat4());
|
||||
Uniform<glm::mat4>(*_program, _mvpUniform).Set(mat4());
|
||||
for_each_eye([&](Eye eye) {
|
||||
eyeViewport(eye);
|
||||
drawUnitQuad();
|
||||
});
|
||||
} else {
|
||||
// Overlay draw
|
||||
Uniform<glm::mat4>(*_program, _projectionUniform).Set(mat4());
|
||||
Uniform<glm::mat4>(*_program, _modelViewUniform).Set(mat4());
|
||||
Uniform<glm::mat4>(*_program, _mvpUniform).Set(mat4());
|
||||
drawUnitQuad();
|
||||
}
|
||||
}
|
||||
|
@ -427,7 +423,7 @@ void OpenGLDisplayPlugin::compositeOverlay() {
|
|||
void OpenGLDisplayPlugin::compositePointer() {
|
||||
using namespace oglplus;
|
||||
auto compositorHelper = DependencyManager::get<CompositorHelper>();
|
||||
Uniform<glm::mat4>(*_program, _modelViewUniform).Set(compositorHelper->getReticleTransform(glm::mat4()));
|
||||
Uniform<glm::mat4>(*_program, _mvpUniform).Set(compositorHelper->getReticleTransform(glm::mat4()));
|
||||
if (isStereo()) {
|
||||
for_each_eye([&](Eye eye) {
|
||||
eyeViewport(eye);
|
||||
|
@ -436,8 +432,7 @@ void OpenGLDisplayPlugin::compositePointer() {
|
|||
} else {
|
||||
drawUnitQuad();
|
||||
}
|
||||
Uniform<glm::mat4>(*_program, _projectionUniform).Set(mat4());
|
||||
Uniform<glm::mat4>(*_program, _modelViewUniform).Set(mat4());
|
||||
Uniform<glm::mat4>(*_program, _mvpUniform).Set(mat4());
|
||||
}
|
||||
|
||||
void OpenGLDisplayPlugin::compositeLayers() {
|
||||
|
@ -452,8 +447,7 @@ void OpenGLDisplayPlugin::compositeLayers() {
|
|||
Context::Clear().DepthBuffer();
|
||||
glBindTexture(GL_TEXTURE_2D, getSceneTextureId());
|
||||
_program->Bind();
|
||||
Uniform<glm::mat4>(*_program, _projectionUniform).Set(mat4());
|
||||
Uniform<glm::mat4>(*_program, _modelViewUniform).Set(mat4());
|
||||
Uniform<glm::mat4>(*_program, _mvpUniform).Set(mat4());
|
||||
drawUnitQuad();
|
||||
auto overlayTextureId = getOverlayTextureId();
|
||||
if (overlayTextureId) {
|
||||
|
|
|
@ -85,8 +85,7 @@ protected:
|
|||
virtual void updateFrameData();
|
||||
|
||||
ProgramPtr _program;
|
||||
int32_t _modelViewUniform { -1 };
|
||||
int32_t _projectionUniform { -1 };
|
||||
int32_t _mvpUniform { -1 };
|
||||
ShapeWrapperPtr _plane;
|
||||
|
||||
mutable Mutex _mutex;
|
||||
|
|
|
@ -66,8 +66,8 @@ void HmdDisplayPlugin::compositeOverlay() {
|
|||
for_each_eye([&](Eye eye) {
|
||||
eyeViewport(eye);
|
||||
auto modelView = glm::inverse(_currentRenderEyePoses[eye]); // *glm::translate(mat4(), vec3(0, 0, -1));
|
||||
Uniform<glm::mat4>(*_program, _modelViewUniform).Set(modelView);
|
||||
Uniform<glm::mat4>(*_program, _projectionUniform).Set(_eyeProjections[eye]);
|
||||
auto mvp = _eyeProjections[eye] * modelView;
|
||||
Uniform<glm::mat4>(*_program, _mvpUniform).Set(mvp);
|
||||
_sphereSection->Draw();
|
||||
});
|
||||
}
|
||||
|
@ -82,8 +82,8 @@ void HmdDisplayPlugin::compositePointer() {
|
|||
using namespace oglplus;
|
||||
eyeViewport(eye);
|
||||
auto reticleTransform = compositorHelper->getReticleTransform(_currentRenderEyePoses[eye], headPosition);
|
||||
Uniform<glm::mat4>(*_program, _modelViewUniform).Set(reticleTransform);
|
||||
Uniform<glm::mat4>(*_program, _projectionUniform).Set(_eyeProjections[eye]);
|
||||
auto mvp = _eyeProjections[eye] * reticleTransform;
|
||||
Uniform<glm::mat4>(*_program, _mvpUniform).Set(mvp);
|
||||
_plane->Draw();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -15,8 +15,7 @@ using namespace oglplus::shapes;
|
|||
static const char * SIMPLE_TEXTURED_VS = R"VS(#version 410 core
|
||||
#pragma line __LINE__
|
||||
|
||||
uniform mat4 Projection = mat4(1);
|
||||
uniform mat4 ModelView = mat4(1);
|
||||
uniform mat4 mvp = mat4(1);
|
||||
|
||||
in vec3 Position;
|
||||
in vec2 TexCoord;
|
||||
|
@ -24,7 +23,7 @@ in vec2 TexCoord;
|
|||
out vec2 vTexCoord;
|
||||
|
||||
void main() {
|
||||
gl_Position = Projection * ModelView * vec4(Position, 1);
|
||||
gl_Position = mvp * vec4(Position, 1);
|
||||
vTexCoord = TexCoord ;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue