Mercurial > hg > orthanc-stone
comparison Framework/Scene2D/Internals/OpenGLColorTextureProgram.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 | e3f21a265be5 |
children | 2d8ab34c8c91 |
comparison
equal
deleted
inserted
replaced
946:dbe3e1e47019 | 947:1091b2adeb5a |
---|---|
34 | 34 |
35 namespace OrthancStone | 35 namespace OrthancStone |
36 { | 36 { |
37 namespace Internals | 37 namespace Internals |
38 { | 38 { |
39 OpenGLColorTextureProgram::OpenGLColorTextureProgram(OpenGL::IOpenGLContext& context) : | 39 OpenGLColorTextureProgram::OpenGLColorTextureProgram(OpenGL::IOpenGLContext& context) |
40 program_(context, FRAGMENT_SHADER) | 40 : program_(context, FRAGMENT_SHADER) |
41 , context_(context) | |
41 { | 42 { |
42 } | 43 } |
43 | 44 |
44 | 45 |
45 void OpenGLColorTextureProgram::Apply(OpenGL::OpenGLTexture& texture, | 46 void OpenGLColorTextureProgram::Apply(OpenGL::OpenGLTexture& texture, |
46 const AffineTransform2D& transform, | 47 const AffineTransform2D& transform, |
47 bool useAlpha) | 48 bool useAlpha) |
48 { | 49 { |
49 OpenGLTextureProgram::Execution execution(program_, texture, transform); | 50 if (!context_.IsContextLost()) |
51 { | |
52 OpenGLTextureProgram::Execution execution(program_, texture, transform); | |
50 | 53 |
51 if (useAlpha) | 54 if (useAlpha) |
52 { | 55 { |
53 glEnable(GL_BLEND); | 56 glEnable(GL_BLEND); |
54 glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); | 57 glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
55 execution.DrawTriangles(); | 58 execution.DrawTriangles(); |
56 glDisable(GL_BLEND); | 59 glDisable(GL_BLEND); |
57 } | 60 } |
58 else | 61 else |
59 { | 62 { |
60 execution.DrawTriangles(); | 63 execution.DrawTriangles(); |
64 } | |
61 } | 65 } |
62 } | 66 } |
63 } | 67 } |
64 } | 68 } |