Trying to fix the damn gamma

This commit is contained in:
Sam Gateau 2019-02-22 18:03:23 -08:00
parent f0c6acdbf6
commit dab0df1113
4 changed files with 38 additions and 4 deletions

View file

@ -516,6 +516,7 @@ void OpenGLDisplayPlugin::renderFromTexture(gpu::Batch& batch, const gpu::Textur
#ifndef USE_GLES
batch.setPipeline(_presentPipeline);
#else
//batch.setPipeline(_presentPipeline);
batch.setPipeline(_simplePipeline);
#endif
batch.draw(gpu::TRIANGLE_STRIP, 4);
@ -630,7 +631,8 @@ void OpenGLDisplayPlugin::compositeScene() {
batch.setStateScissorRect(ivec4(uvec2(), _compositeFramebuffer->getSize()));
batch.resetViewTransform();
batch.setProjectionTransform(mat4());
batch.setPipeline(_simplePipeline);
// batch.setPipeline(_simplePipeline);
batch.setPipeline(_presentPipeline);
batch.setResourceTexture(0, _currentFrame->framebuffer->getRenderBuffer(0));
batch.draw(gpu::TRIANGLE_STRIP, 4);
});
@ -885,6 +887,7 @@ void OpenGLDisplayPlugin::updateCompositeFramebuffer() {
auto renderSize = glm::uvec2(getRecommendedRenderSize());
if (!_compositeFramebuffer || _compositeFramebuffer->getSize() != renderSize) {
_compositeFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("OpenGLDisplayPlugin::composite", gpu::Element::COLOR_RGBA_32, renderSize.x, renderSize.y));
// _compositeFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("OpenGLDisplayPlugin::composite", gpu::Element::COLOR_SRGBA_32, renderSize.x, renderSize.y));
}
}

View file

@ -18,5 +18,6 @@ vec3 colorToLinearRGB(vec3 srgb) {
void main(void) {
outFragColor.a = 1.0;
outFragColor.rgb = colorToLinearRGB(texture(colorMap, varTexCoord0).rgb);
// outFragColor.rgb = colorToLinearRGB(texture(colorMap, varTexCoord0).rgb);
outFragColor.rgb = pow(texture(colorMap, varTexCoord0).rgb, vec3(1.0 / 2.2));
}

View file

@ -6,6 +6,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "OculusMobileDisplayPlugin.h"
#include "../../oculusMobile/src/ovr/Helpers.h"
#include <QtAndroidExtras/QAndroidJniEnvironment>
#include <glm/gtc/matrix_transform.hpp>
@ -58,7 +59,7 @@ void OculusMobileDisplayPlugin::deinit() {
bool OculusMobileDisplayPlugin::internalActivate() {
_renderTargetSize = { 1024, 512 };
_cullingProjection = ovr::toGlm(ovrMatrix4f_CreateProjectionFov(90.0f, 90.0f, 0.0f, 0.0f, DEFAULT_NEAR_CLIP, DEFAULT_FAR_CLIP));
_cullingProjection = ovr::toGlm(ovrMatrix4f_CreateProjectionFov(90.0f, 90.0f, 90.0f, 90.0f, DEFAULT_NEAR_CLIP, DEFAULT_FAR_CLIP));
withOvrJava([&](const ovrJava* java){
@ -130,6 +131,7 @@ glm::mat4 OculusMobileDisplayPlugin::getEyeProjection(Eye eye, const glm::mat4&
glm::mat4 OculusMobileDisplayPlugin::getCullingProjection(const glm::mat4& baseProjection) const {
glm::mat4 result = baseProjection;
VrHandler::withOvrMobile([&](ovrMobile* session){
auto trackingState = vrapi_GetPredictedTracking2(session, 0.0);
ovr::Fov fovs[2];
@ -137,7 +139,14 @@ glm::mat4 OculusMobileDisplayPlugin::getCullingProjection(const glm::mat4& baseP
fovs[i].extract(trackingState.Eye[i].ProjectionMatrix);
}
fovs[0].extend(fovs[1]);
return fovs[0].withZ(baseProjection);
float horizontalMargin = 1.1f;
float verticalMargin = 1.5f;
fovs[0].leftRightUpDown[0] *= horizontalMargin;
fovs[0].leftRightUpDown[1] *= horizontalMargin;
fovs[0].leftRightUpDown[2] *= verticalMargin;
fovs[0].leftRightUpDown[3] *= verticalMargin;
return fovs[0].withZ(baseProjection);
});
return result;
}

View file

@ -148,6 +148,27 @@ Rectangle {
}
}
Separator {}
Column {
anchors.left: parent.left
anchors.right: parent.right
spacing: 5
Repeater {
model: [ "MSAA:PrepareFramebuffer:numSamples:4:1"
]
ConfigSlider {
label: qsTr(modelData.split(":")[0])
integral: true
config: render.mainViewTask.getConfig(modelData.split(":")[1])
property: modelData.split(":")[2]
max: modelData.split(":")[3]
min: modelData.split(":")[4]
anchors.left: parent.left
anchors.right: parent.right
}
}
}
Separator {}
Item {
height: childrenRect.height