Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Scene2D/Internals/OpenGLTextureProgram.h @ 2113:8ab2eb6ed354
fix for boost 1.84.0
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 24 Jan 2024 16:42:38 +0100 |
parents | 07964689cb0b |
children | c23eef785569 |
rev | line source |
---|---|
591 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
2077
07964689cb0b
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
07964689cb0b
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
6 * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
591 | 7 * |
8 * This program is free software: you can redistribute it and/or | |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public License |
591 | 10 * as published by the Free Software Foundation, either version 3 of |
11 * the License, or (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
16 * Lesser General Public License for more details. |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1576
diff
changeset
|
17 * |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
19 * License along with this program. If not, see |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
20 * <http://www.gnu.org/licenses/>. |
591 | 21 **/ |
22 | |
23 | |
24 #pragma once | |
25 | |
26 #include "../../OpenGL/IOpenGLContext.h" | |
27 #include "../../OpenGL/OpenGLProgram.h" | |
28 #include "../../OpenGL/OpenGLTexture.h" | |
29 #include "../../Toolbox/AffineTransform2D.h" | |
30 | |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1300
diff
changeset
|
31 #include <Compatibility.h> |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
32 |
591 | 33 namespace OrthancStone |
34 { | |
35 namespace Internals | |
36 { | |
37 class OpenGLTextureProgram : public boost::noncopyable | |
38 { | |
39 private: | |
40 OpenGL::IOpenGLContext& context_; | |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
41 std::unique_ptr<OpenGL::OpenGLProgram> program_; |
591 | 42 GLint positionLocation_; |
43 GLint textureLocation_; | |
44 GLuint buffers_[2]; | |
45 | |
46 void InitializeExecution(OpenGL::OpenGLTexture& texture, | |
1576
92fca2b3ba3d
sanitizing the handling of canvas size
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
47 const AffineTransform2D& transform, |
92fca2b3ba3d
sanitizing the handling of canvas size
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
48 unsigned int canvasWidth, |
92fca2b3ba3d
sanitizing the handling of canvas size
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
49 unsigned int canvasHeight); |
591 | 50 |
51 void FinalizeExecution(); | |
52 | |
53 public: | |
54 OpenGLTextureProgram(OpenGL::IOpenGLContext& context, | |
55 const char* fragmentShader); | |
56 | |
57 ~OpenGLTextureProgram(); | |
58 | |
59 class Execution : public boost::noncopyable | |
60 { | |
61 private: | |
62 OpenGLTextureProgram& that_; | |
63 | |
64 public: | |
65 Execution(OpenGLTextureProgram& that, | |
66 OpenGL::OpenGLTexture& texture, | |
1576
92fca2b3ba3d
sanitizing the handling of canvas size
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
67 const AffineTransform2D& transform, |
92fca2b3ba3d
sanitizing the handling of canvas size
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
68 unsigned int canvasWidth, |
92fca2b3ba3d
sanitizing the handling of canvas size
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
69 unsigned int canvasHeight) : |
591 | 70 that_(that) |
71 { | |
1576
92fca2b3ba3d
sanitizing the handling of canvas size
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
72 that_.InitializeExecution(texture, transform, canvasWidth, canvasHeight); |
591 | 73 } |
74 | |
75 ~Execution() | |
76 { | |
77 that_.FinalizeExecution(); | |
78 } | |
79 | |
80 void DrawTriangles(); | |
81 | |
82 GLint GetUniformLocation(const std::string& name) | |
83 { | |
84 return that_.program_->GetUniformLocation(name); | |
85 } | |
86 }; | |
87 }; | |
88 } | |
89 } |