annotate OrthancStone/Sources/Scene2D/Internals/OpenGLTextureProgram.cpp @ 1512:244ad1e4e76a

reorganization of folders
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 Jul 2020 16:21:02 +0200
parents Framework/Scene2D/Internals/OpenGLTextureProgram.cpp@30deba7bc8e2
children 92fca2b3ba3d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
591
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
1270
2d8ab34c8c91 upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 947
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
591
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #include "OpenGLTextureProgram.h"
611
e3f21a265be5 Added version directive to GLSL shader code + glew init function in sample code
Benjamin Golinvaux <bgo@osimis.io>
parents: 591
diff changeset
23 #include "OpenGLShaderVersionDirective.h"
591
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
1455
30deba7bc8e2 simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1270
diff changeset
25 #include <OrthancException.h>
947
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
26
591
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 static const unsigned int COMPONENTS = 2;
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 static const unsigned int COUNT = 6; // 2 triangles in 2D
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 static const char* VERTEX_SHADER =
611
e3f21a265be5 Added version directive to GLSL shader code + glew init function in sample code
Benjamin Golinvaux <bgo@osimis.io>
parents: 591
diff changeset
31 ORTHANC_STONE_OPENGL_SHADER_VERSION_DIRECTIVE
591
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 "attribute vec2 a_texcoord; \n"
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 "attribute vec4 a_position; \n"
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 "uniform mat4 u_matrix; \n"
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 "varying vec2 v_texcoord; \n"
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 "void main() \n"
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 "{ \n"
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 " gl_Position = u_matrix * a_position; \n"
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 " v_texcoord = a_texcoord; \n"
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 "}";
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 namespace OrthancStone
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 {
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 namespace Internals
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 {
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 void OpenGLTextureProgram::InitializeExecution(OpenGL::OpenGLTexture& texture,
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 const AffineTransform2D& transform)
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 {
947
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
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: 611
diff changeset
51 {
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
52 context_.MakeCurrent();
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
53 program_->Use();
591
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54
947
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
55 AffineTransform2D scale = AffineTransform2D::CreateScaling
591
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 (texture.GetWidth(), texture.GetHeight());
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57
947
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
58 AffineTransform2D t = AffineTransform2D::Combine(transform, scale);
591
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59
947
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
60 float m[16];
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
61 t.ConvertToOpenGLMatrix(m, context_.GetCanvasWidth(), context_.GetCanvasHeight());
591
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62
947
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
63 texture.Bind(program_->GetUniformLocation("u_texture"));
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
64 glUniformMatrix4fv(program_->GetUniformLocation("u_matrix"), 1, GL_FALSE, m);
591
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65
947
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
66 glBindBuffer(GL_ARRAY_BUFFER, buffers_[0]);
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
67 glEnableVertexAttribArray(positionLocation_);
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
68 glVertexAttribPointer(positionLocation_, COMPONENTS, GL_FLOAT, GL_FALSE, 0, 0);
591
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69
947
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
70 glBindBuffer(GL_ARRAY_BUFFER, buffers_[1]);
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
71 glEnableVertexAttribArray(textureLocation_);
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
72 glVertexAttribPointer(textureLocation_, COMPONENTS, GL_FLOAT, GL_FALSE, 0, 0);
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
73 }
591
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 }
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 void OpenGLTextureProgram::FinalizeExecution()
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 {
947
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
78 if (!context_.IsContextLost())
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
79 {
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
80 glDisableVertexAttribArray(positionLocation_);
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
81 glDisableVertexAttribArray(textureLocation_);
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
82 }
591
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 }
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 OpenGLTextureProgram::OpenGLTextureProgram(OpenGL::IOpenGLContext& context,
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 const char* fragmentShader) :
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 context_(context)
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 {
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 static const float POSITIONS[COMPONENTS * COUNT] = {
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 0, 0,
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 0, 1,
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 1, 0,
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 1, 0,
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 0, 1,
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 1, 1
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 };
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97
947
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
98 if (!context_.IsContextLost())
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
99 {
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
100 context_.MakeCurrent();
591
b66ced2c43d4 OpenGLTextureProgram
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: 611
diff changeset
102 program_.reset(new OpenGL::OpenGLProgram(context_));
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
103 program_->CompileShaders(VERTEX_SHADER, fragmentShader);
591
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104
947
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
105 positionLocation_ = program_->GetAttributeLocation("a_position");
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
106 textureLocation_ = program_->GetAttributeLocation("a_texcoord");
591
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107
947
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
108 glGenBuffers(2, buffers_);
591
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109
947
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
110 glBindBuffer(GL_ARRAY_BUFFER, buffers_[0]);
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
111 glBufferData(GL_ARRAY_BUFFER, sizeof(float) * COMPONENTS * COUNT, POSITIONS, GL_STATIC_DRAW);
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
112
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
113 glBindBuffer(GL_ARRAY_BUFFER, buffers_[1]);
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
114 glBufferData(GL_ARRAY_BUFFER, sizeof(float) * COMPONENTS * COUNT, POSITIONS, GL_STATIC_DRAW);
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
115 }
591
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 }
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 OpenGLTextureProgram::~OpenGLTextureProgram()
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 {
947
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
120 if (!context_.IsContextLost())
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
121 {
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
122 ORTHANC_OPENGL_TRACE_CURRENT_CONTEXT("OpenGLTextureProgram::~OpenGLTextureProgram() | About to call glDeleteBuffers");
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
123 context_.MakeCurrent();
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
124 glDeleteBuffers(2, buffers_);
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
125 }
591
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 }
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 void OpenGLTextureProgram::Execution::DrawTriangles()
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 {
947
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
131 if (!that_.context_.IsContextLost())
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
132 {
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
133 glDrawArrays(GL_TRIANGLES, 0, COUNT);
1091b2adeb5a Fixed animation frame stopping when returning false + big work on the OpenGL
Benjamin Golinvaux <bgo@osimis.io>
parents: 611
diff changeset
134 }
591
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 }
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 }
b66ced2c43d4 OpenGLTextureProgram
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 }