Mercurial > hg > orthanc-stone
comparison Framework/Scene2D/Internals/OpenGLLinesProgram.cpp @ 611:e3f21a265be5
Added version directive to GLSL shader code + glew init function in sample code
AND commented-out glew init function in StoneInitialize
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 30 Apr 2019 16:07:48 +0200 |
parents | bbe29efd3d1c |
children | 9a474e90e832 8b6adfb62a2f |
comparison
equal
deleted
inserted
replaced
610:0c4c0693b97c | 611:e3f21a265be5 |
---|---|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 **/ | 19 **/ |
20 | 20 |
21 | 21 |
22 #include "OpenGLLinesProgram.h" | 22 #include "OpenGLLinesProgram.h" |
23 #include "OpenGLShaderVersionDirective.h" | |
23 | 24 |
24 #include <Core/OrthancException.h> | 25 #include <Core/OrthancException.h> |
25 | 26 |
26 | 27 |
27 static const unsigned int COMPONENTS_POSITION = 3; | 28 static const unsigned int COMPONENTS_POSITION = 3; |
28 static const unsigned int COMPONENTS_MITER = 2; | 29 static const unsigned int COMPONENTS_MITER = 2; |
29 | 30 |
30 | 31 |
31 static const char* VERTEX_SHADER = | 32 static const char* VERTEX_SHADER = |
33 ORTHANC_STONE_OPENGL_SHADER_VERSION_DIRECTIVE | |
32 "attribute vec2 a_miter_direction; \n" | 34 "attribute vec2 a_miter_direction; \n" |
33 "attribute vec4 a_position; \n" | 35 "attribute vec4 a_position; \n" |
34 "uniform float u_thickness; \n" | 36 "uniform float u_thickness; \n" |
35 "uniform mat4 u_matrix; \n" | 37 "uniform mat4 u_matrix; \n" |
36 "varying float v_distance; \n" | 38 "varying float v_distance; \n" |
40 " gl_Position = u_matrix * vec4(a_position.xy + a_position.z * a_miter_direction * u_thickness, 0, 1); \n" | 42 " gl_Position = u_matrix * vec4(a_position.xy + a_position.z * a_miter_direction * u_thickness, 0, 1); \n" |
41 "}"; | 43 "}"; |
42 | 44 |
43 | 45 |
44 static const char* FRAGMENT_SHADER = | 46 static const char* FRAGMENT_SHADER = |
47 ORTHANC_STONE_OPENGL_SHADER_VERSION_DIRECTIVE | |
45 "uniform bool u_antialiasing; \n" | 48 "uniform bool u_antialiasing; \n" |
46 "uniform float u_antialiasing_start; \n" | 49 "uniform float u_antialiasing_start; \n" |
47 "uniform vec3 u_color; \n" | 50 "uniform vec3 u_color; \n" |
48 "varying float v_distance; \n" // Distance of the point to the segment | 51 "varying float v_distance; \n" // Distance of the point to the segment |
49 "void main() \n" | 52 "void main() \n" |