Mercurial > hg > orthanc-stone
comparison Framework/Scene2D/Internals/OpenGLBasicPolylineRenderer.cpp @ 804:61ba4b504e9a
PolylineSceneLayer now has one color per chain
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 28 May 2019 15:58:21 +0200 |
parents | 1e26bb5f2a02 |
children | 1091b2adeb5a |
comparison
equal
deleted
inserted
replaced
802:f38c1fc08655 | 804:61ba4b504e9a |
---|---|
26 namespace OrthancStone | 26 namespace OrthancStone |
27 { | 27 { |
28 namespace Internals | 28 namespace Internals |
29 { | 29 { |
30 OpenGLBasicPolylineRenderer::OpenGLBasicPolylineRenderer(OpenGL::IOpenGLContext& context, | 30 OpenGLBasicPolylineRenderer::OpenGLBasicPolylineRenderer(OpenGL::IOpenGLContext& context, |
31 const PolylineSceneLayer& layer) : | 31 const PolylineSceneLayer& layer) : |
32 context_(context) | 32 context_(context) |
33 { | 33 { |
34 layer_.Copy(layer); | 34 layer_.Copy(layer); |
35 } | 35 } |
36 | 36 |
40 AffineTransform2D t = AffineTransform2D::Combine( | 40 AffineTransform2D t = AffineTransform2D::Combine( |
41 AffineTransform2D::CreateOpenGLClipspace(context_.GetCanvasWidth(), context_.GetCanvasHeight()), | 41 AffineTransform2D::CreateOpenGLClipspace(context_.GetCanvasWidth(), context_.GetCanvasHeight()), |
42 transform); | 42 transform); |
43 | 43 |
44 glUseProgram(0); | 44 glUseProgram(0); |
45 glColor3ub(layer_.GetRed(), layer_.GetGreen(), layer_.GetBlue()); | |
46 | 45 |
47 glBegin(GL_LINES); | 46 glBegin(GL_LINES); |
48 | 47 |
49 for (size_t i = 0; i < layer_.GetChainsCount(); i++) | 48 for (size_t i = 0; i < layer_.GetChainsCount(); i++) |
50 { | 49 { |
50 const Color& color = layer_.GetColor(i); | |
51 glColor3ub(color.GetRed(), color.GetGreen(), color.GetBlue()); | |
52 | |
51 const PolylineSceneLayer::Chain& chain = layer_.GetChain(i); | 53 const PolylineSceneLayer::Chain& chain = layer_.GetChain(i); |
52 | 54 |
53 if (chain.size() > 1) | 55 if (chain.size() > 1) |
54 { | 56 { |
55 ScenePoint2D previous = chain[0].Apply(t); | 57 ScenePoint2D previous = chain[0].Apply(t); |