Mercurial > hg > orthanc-stone
comparison Framework/Scene2D/Internals/OpenGLFloatTextureRenderer.cpp @ 947:1091b2adeb5a toa2019081001
Fixed animation frame stopping when returning false + big work on the OpenGL
objects to make them lost context-safe + debug code to forcefully tag a
context as lost + debug macros
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Sat, 10 Aug 2019 13:07:31 +0200 |
parents | 4d1f57773b5b |
children | 177e7d431cd1 2d8ab34c8c91 |
comparison
equal
deleted
inserted
replaced
946:dbe3e1e47019 | 947:1091b2adeb5a |
---|---|
26 namespace Internals | 26 namespace Internals |
27 { | 27 { |
28 void OpenGLFloatTextureRenderer::UpdateInternal(const FloatTextureSceneLayer& layer, | 28 void OpenGLFloatTextureRenderer::UpdateInternal(const FloatTextureSceneLayer& layer, |
29 bool loadTexture) | 29 bool loadTexture) |
30 { | 30 { |
31 if (loadTexture) | 31 if (!context_.IsContextLost()) |
32 { | 32 { |
33 context_.MakeCurrent(); | 33 if (loadTexture) |
34 texture_.reset(new OpenGLFloatTextureProgram::Data(layer.GetTexture(), layer.IsLinearInterpolation())); | 34 { |
35 context_.MakeCurrent(); | |
36 texture_.reset(new OpenGLFloatTextureProgram::Data( | |
37 context_, layer.GetTexture(), layer.IsLinearInterpolation())); | |
38 } | |
39 | |
40 layerTransform_ = layer.GetTransform(); | |
41 layer.GetWindowing(windowCenter_, windowWidth_); | |
42 invert_ = layer.IsInverted(); | |
35 } | 43 } |
36 | |
37 layerTransform_ = layer.GetTransform(); | |
38 layer.GetWindowing(windowCenter_, windowWidth_); | |
39 invert_ = layer.IsInverted(); | |
40 } | 44 } |
41 | 45 |
42 | 46 |
43 OpenGLFloatTextureRenderer::OpenGLFloatTextureRenderer(OpenGL::IOpenGLContext& context, | 47 OpenGLFloatTextureRenderer::OpenGLFloatTextureRenderer(OpenGL::IOpenGLContext& context, |
44 OpenGLFloatTextureProgram& program, | 48 OpenGLFloatTextureProgram& program, |
52 | 56 |
53 void OpenGLFloatTextureRenderer::Render(const AffineTransform2D& transform, | 57 void OpenGLFloatTextureRenderer::Render(const AffineTransform2D& transform, |
54 unsigned int canvasWidth, | 58 unsigned int canvasWidth, |
55 unsigned int canvasHeight) | 59 unsigned int canvasHeight) |
56 { | 60 { |
57 if (texture_.get() != NULL) | 61 if (!context_.IsContextLost() && texture_.get() != NULL) |
58 { | 62 { |
59 program_.Apply(*texture_, AffineTransform2D::Combine(transform, layerTransform_), | 63 program_.Apply(*texture_, AffineTransform2D::Combine(transform, layerTransform_), |
60 windowCenter_, windowWidth_, invert_); | 64 windowCenter_, windowWidth_, invert_); |
61 } | 65 } |
62 } | 66 } |