mirror of
https://github.com/lubosz/overte.git
synced 2025-04-19 16:44:04 +02:00
fixed gamma on windows
This commit is contained in:
parent
1d3867d777
commit
4cf8023d0e
4 changed files with 23 additions and 3 deletions
|
@ -113,7 +113,15 @@ gpu::PipelinePointer Basic2DWindowOpenGLDisplayPlugin::getCompositeScenePipeline
|
|||
#if defined(Q_OS_ANDROID)
|
||||
return _compositePipeline;
|
||||
#endif
|
||||
return _drawTexturePipeline;
|
||||
//return _drawTexturePipeline;
|
||||
return _SRGBToLinearPipeline;
|
||||
}
|
||||
|
||||
gpu::Element Basic2DWindowOpenGLDisplayPlugin::getCompositeFBColorSpace() {
|
||||
#if defined(Q_OS_ANDROID)
|
||||
return gpu::Element::COLOR_SRGBA_32;
|
||||
#endif
|
||||
return gpu::Element::COLOR_RGBA_32;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
virtual void pluginUpdate() override {};
|
||||
|
||||
virtual gpu::PipelinePointer getCompositeScenePipeline() override;
|
||||
virtual gpu::Element getCompositeFBColorSpace() override;
|
||||
|
||||
protected:
|
||||
mutable bool _isThrottled = false;
|
||||
|
|
|
@ -400,6 +400,9 @@ void OpenGLDisplayPlugin::customizeContext() {
|
|||
{
|
||||
_compositePipeline = gpu::Pipeline::create(gpu::Shader::createProgram(DrawTextureGammaLinearToSRGB), scissorState);
|
||||
}
|
||||
{
|
||||
_SRGBToLinearPipeline = gpu::Pipeline::create(gpu::Shader::createProgram(DrawTextureGammaSRGBToLinear), scissorState);
|
||||
}
|
||||
{
|
||||
_hudPipeline = gpu::Pipeline::create(gpu::Shader::createProgram(DrawTexture), blendState);
|
||||
}
|
||||
|
@ -525,7 +528,7 @@ void OpenGLDisplayPlugin::renderFromTexture(gpu::Batch& batch, const gpu::Textur
|
|||
batch.setResourceTexture(0, texture);
|
||||
|
||||
batch.setPipeline(_drawTexturePipeline);
|
||||
|
||||
|
||||
batch.draw(gpu::TRIANGLE_STRIP, 4);
|
||||
if (copyFbo) {
|
||||
gpu::Vec4i copyFboRect(0, 0, copyFbo->getWidth(), copyFbo->getHeight());
|
||||
|
@ -914,10 +917,14 @@ void OpenGLDisplayPlugin::render(std::function<void(gpu::Batch& batch)> f) {
|
|||
OpenGLDisplayPlugin::~OpenGLDisplayPlugin() {
|
||||
}
|
||||
|
||||
gpu::Element OpenGLDisplayPlugin::getCompositeFBColorSpace() {
|
||||
return gpu::Element::COLOR_RGBA_32;
|
||||
}
|
||||
|
||||
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", getCompositeFBColorSpace(), renderSize.x, renderSize.y));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,9 @@ protected:
|
|||
virtual std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> getHUDOperator();
|
||||
virtual void compositePointer();
|
||||
virtual void compositeExtra() {};
|
||||
|
||||
virtual gpu::PipelinePointer getCompositeScenePipeline();
|
||||
virtual gpu::Element getCompositeFBColorSpace();
|
||||
|
||||
// These functions must only be called on the presentation thread
|
||||
virtual void customizeContext();
|
||||
|
@ -152,7 +154,9 @@ protected:
|
|||
gpu::ShaderPointer _mirrorHUDPS;
|
||||
gpu::PipelinePointer _drawTexturePipeline;
|
||||
gpu::PipelinePointer _compositePipeline;
|
||||
gpu::PipelinePointer _SRGBToLinearPipeline;
|
||||
gpu::PipelinePointer _cursorPipeline;
|
||||
|
||||
gpu::TexturePointer _displayTexture{};
|
||||
float _compositeHUDAlpha { 1.0f };
|
||||
|
||||
|
|
Loading…
Reference in a new issue