Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/OpenGL/OpenGLShader.cpp @ 2058:c0627145b441 deep-learning
added OpenGLTexture::IsLinearInterpolation()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 24 Apr 2023 17:09:23 +0200 |
parents | 85a20cbfcc04 |
children | fdb012c86a75 |
rev | line source |
---|---|
578
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Stone of Orthanc |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
1871
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
578
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
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 |
578
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * as published by the Free Software Foundation, either version 3 of |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * the License, or (at your option) any later version. |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, but |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
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:
1571
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/>. |
578
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 **/ |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #include "OpenGLShader.h" |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 |
1624 | 26 #include <Logging.h> |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
27 #include <OrthancException.h> |
578
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 namespace OrthancStone |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 { |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 namespace OpenGL |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 { |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 static GLuint CompileShader(GLenum type, |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 const std::string& source) |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 { |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 // Create shader object |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 const GLchar* sourceString[1]; |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 GLint sourceStringLengths[1]; |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 sourceString[0] = source.c_str(); |
701
58e1faeafb1b
Fixed truncating conversion warning
Benjamin Golinvaux <bgo@osimis.io>
parents:
599
diff
changeset
|
41 sourceStringLengths[0] = static_cast<GLint>(source.length()); |
578
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 GLuint shader = glCreateShader(type); |
947
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
43 ORTHANC_OPENGL_CHECK("glCreateShader"); |
578
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 if (shader == 0) |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 { |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 "Cannot create an OpenGL shader"); |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 } |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 else |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 { |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 // Assign and compile the source to the shader object |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 glShaderSource(shader, 1, sourceString, sourceStringLengths); |
947
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
54 ORTHANC_OPENGL_CHECK("glShaderSource"); |
578
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 glCompileShader(shader); |
947
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
56 ORTHANC_OPENGL_CHECK("glCompileShader"); |
578
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 |
2040
c6263f514f54
allow warnings while creating shaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
58 GLenum error = glGetError(); |
c6263f514f54
allow warnings while creating shaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
59 |
578
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 // Check if there were errors |
2041
85a20cbfcc04
check glUseProgram()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2040
diff
changeset
|
61 GLint infoLen = 0; |
578
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen); |
947
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
63 ORTHANC_OPENGL_CHECK("glGetShaderiv"); |
578
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 |
599 | 65 if (infoLen > 1) // Might be equal to 1, which amounts to no error |
578
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 { |
584
434ceeb0bcab
layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
579
diff
changeset
|
67 std::string infoLog; |
434ceeb0bcab
layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
579
diff
changeset
|
68 infoLog.resize(infoLen + 1); |
434ceeb0bcab
layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
579
diff
changeset
|
69 glGetShaderInfoLog(shader, infoLen, NULL, &infoLog[0]); |
578
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 |
2040
c6263f514f54
allow warnings while creating shaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
71 if (error) |
c6263f514f54
allow warnings while creating shaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
72 { |
c6263f514f54
allow warnings while creating shaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
73 ORTHANC_OPENGL_CHECK("glGetShaderInfoLog"); |
c6263f514f54
allow warnings while creating shaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
74 ORTHANC_OPENGL_TRACE_CURRENT_CONTEXT("About to call glDeleteShader"); |
c6263f514f54
allow warnings while creating shaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
75 glDeleteShader(shader); |
c6263f514f54
allow warnings while creating shaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
76 ORTHANC_OPENGL_CHECK("glDeleteShader"); |
c6263f514f54
allow warnings while creating shaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
77 |
c6263f514f54
allow warnings while creating shaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
78 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, |
c6263f514f54
allow warnings while creating shaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
79 "Error while creating an OpenGL shader: " + infoLog); |
c6263f514f54
allow warnings while creating shaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
80 } |
c6263f514f54
allow warnings while creating shaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
81 else |
c6263f514f54
allow warnings while creating shaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
82 { |
c6263f514f54
allow warnings while creating shaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
83 LOG(WARNING) << "Warning while creating an OpenGL shader: " << infoLog; |
c6263f514f54
allow warnings while creating shaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
84 } |
578
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 } |
2040
c6263f514f54
allow warnings while creating shaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
86 |
c6263f514f54
allow warnings while creating shaders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
87 return shader; |
578
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 } |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 } |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 OpenGLShader::OpenGLShader(GLenum type, |
1571 | 93 const std::string& source) : |
94 shader_(CompileShader(type, source)) | |
578
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 { |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 isValid_ = true; |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 } |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 OpenGLShader::~OpenGLShader() |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 { |
947
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
102 try |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
103 { |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
104 if (isValid_) |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
105 { |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
106 ORTHANC_OPENGL_TRACE_CURRENT_CONTEXT("About to call glDeleteShader"); |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
107 glDeleteShader(shader_); |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
108 ORTHANC_OPENGL_CHECK("glDeleteShader"); |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
109 } |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
110 } |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
111 catch (const Orthanc::OrthancException& e) |
578
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
112 { |
947
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
113 if (e.HasDetails()) |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
114 { |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
115 LOG(ERROR) << "OrthancException in ~OpenGLShader: " << e.What() << " Details: " << e.GetDetails(); |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
116 } |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
117 else |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
118 { |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
119 LOG(ERROR) << "OrthancException in ~OpenGLShader: " << e.What(); |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
120 } |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
121 } |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
122 catch (const std::exception& e) |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
123 { |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
124 LOG(ERROR) << "std::exception in ~OpenGLShader: " << e.what(); |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
125 } |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
126 catch (...) |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
127 { |
1091b2adeb5a
Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents:
701
diff
changeset
|
128 LOG(ERROR) << "Unknown exception in ~OpenGLShader"; |
578
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
129 } |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
130 } |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
131 |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
132 GLuint OpenGLShader::Release() |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
133 { |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 if (isValid_) |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
135 { |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 isValid_ = false; |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
137 return shader_; |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
138 } |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 else |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
140 { |
956
a7351ad54960
Made IsContextLost automatically set the flag by checking with the emscripten
Benjamin Golinvaux <bgo@osimis.io>
parents:
947
diff
changeset
|
141 LOG(ERROR) << "OpenGLShader::Release(): (!isValid_)"; |
578
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
142 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
143 } |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
144 } |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 } |
21fd70df3fc9
starting work on OpenGL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
146 } |