Mercurial > hg > orthanc-stone
annotate Framework/OpenGL/OpenGLProgram.cpp @ 1039:3a35d8397559
merge
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Mon, 07 Oct 2019 22:37:24 +0200 |
parents | 1091b2adeb5a |
children | 6a9300ecfa13 |
rev | line source |
---|---|
579
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Stone of Orthanc |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Affero General Public License |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * the License, or (at your option) any later version. |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * Affero General Public License for more details. |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Affero General Public License |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 **/ |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 #include "OpenGLProgram.h" |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #include "OpenGLShader.h" |
947
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
25 #include "IOpenGLContext.h" |
579
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 #include <Core/OrthancException.h> |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 namespace OrthancStone |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 { |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 namespace OpenGL |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 { |
947
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
33 OpenGLProgram::OpenGLProgram(OpenGL::IOpenGLContext& context) |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
34 : context_(context) |
579
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 { |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 program_ = glCreateProgram(); |
947
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
37 ORTHANC_OPENGL_CHECK("glCreateProgram"); |
579
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 if (program_ == 0) |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 { |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 "Cannot create an OpenGL program"); |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 } |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 } |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 OpenGLProgram::~OpenGLProgram() |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 { |
947
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
48 try |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
49 { |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
50 if (!context_.IsContextLost()) |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
51 { |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
52 ORTHANC_CHECK_CURRENT_CONTEXT(context_); |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
53 ORTHANC_OPENGL_TRACE_CURRENT_CONTEXT("About to call glDeleteProgram"); |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
54 assert(program_ != 0); |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
55 glDeleteProgram(program_); |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
56 ORTHANC_OPENGL_CHECK("glDeleteProgram"); |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
57 } |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
58 } |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
59 catch (const Orthanc::OrthancException& e) |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
60 { |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
61 if (e.HasDetails()) |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
62 { |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
63 LOG(ERROR) << "OrthancException in ~OpenGLProgram: " << e.What() << " Details: " << e.GetDetails(); |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
64 } |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
65 else |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
66 { |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
67 LOG(ERROR) << "OrthancException in ~OpenGLProgram: " << e.What(); |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
68 } |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
69 } |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
70 catch (const std::exception& e) |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
71 { |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
72 LOG(ERROR) << "std::exception in ~OpenGLProgram: " << e.what(); |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
73 } |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
74 catch (...) |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
75 { |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
76 LOG(ERROR) << "Unknown exception in ~OpenGLProgram"; |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
77 } |
579
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 } |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 void OpenGLProgram::Use() |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 { |
947
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
82 //ORTHANC_OPENGL_TRACE_CURRENT_CONTEXT("About to call glUseProgram"); |
579
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 glUseProgram(program_); |
947
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
84 ORTHANC_OPENGL_CHECK("glUseProgram"); |
579
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 } |
947
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
86 |
579
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 void OpenGLProgram::CompileShaders(const std::string& vertexCode, |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 const std::string& fragmentCode) |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 { |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 assert(program_ != 0); |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 OpenGLShader vertexShader(GL_VERTEX_SHADER, vertexCode); |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 OpenGLShader fragmentShader(GL_FRAGMENT_SHADER, fragmentCode); |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 glAttachShader(program_, vertexShader.Release()); |
947
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
96 ORTHANC_OPENGL_CHECK("glAttachShader"); |
579
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 glAttachShader(program_, fragmentShader.Release()); |
947
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
98 ORTHANC_OPENGL_CHECK("glAttachShader"); |
579
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 glLinkProgram(program_); |
947
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
100 ORTHANC_OPENGL_CHECK("glLinkProgram"); |
579
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 glValidateProgram(program_); |
947
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
102 ORTHANC_OPENGL_CHECK("glValidateProgram"); |
579
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 } |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
105 GLint OpenGLProgram::GetUniformLocation(const std::string& name) |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
106 { |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
107 GLint location = glGetUniformLocation(program_, name.c_str()); |
947
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
108 ORTHANC_OPENGL_CHECK("glGetUniformLocation"); |
579
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
109 |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
110 if (location == -1) |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
111 { |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
112 throw Orthanc::OrthancException(Orthanc::ErrorCode_InexistentItem, |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
113 "Inexistent uniform variable in shader: " + name); |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
114 } |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
115 else |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
116 { |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 return location; |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 } |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 } |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 GLint OpenGLProgram::GetAttributeLocation(const std::string& name) |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 { |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
124 GLint location = glGetAttribLocation(program_, name.c_str()); |
947
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
579
diff
changeset
|
125 ORTHANC_OPENGL_CHECK("glGetAttribLocation"); |
579
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
126 |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
127 if (location == -1) |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
128 { |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
129 throw Orthanc::OrthancException(Orthanc::ErrorCode_InexistentItem, |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
130 "Inexistent attribute in shader: " + name); |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
131 } |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
132 else |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
133 { |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 return location; |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
135 } |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 } |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
137 } |
fadacfbf5538
OpenGL programs and textures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
138 } |