comparison Framework/Scene2D/Internals/OpenGLTextProgram.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 "OpenGLTextProgram.h" 22 #include "OpenGLTextProgram.h"
23 #include "OpenGLShaderVersionDirective.h"
23 24
24 #include "../../Fonts/OpenGLTextCoordinates.h" 25 #include "../../Fonts/OpenGLTextCoordinates.h"
25 26
26 #include <Core/OrthancException.h> 27 #include <Core/OrthancException.h>
27 28
28 29
29 static const unsigned int COMPONENTS = 2; 30 static const unsigned int COMPONENTS = 2;
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_texcoord; \n" 34 "attribute vec2 a_texcoord; \n"
33 "attribute vec4 a_position; \n" 35 "attribute vec4 a_position; \n"
34 "uniform mat4 u_matrix; \n" 36 "uniform mat4 u_matrix; \n"
35 "varying vec2 v_texcoord; \n" 37 "varying vec2 v_texcoord; \n"
36 "void main() \n" 38 "void main() \n"
38 " gl_Position = u_matrix * a_position; \n" 40 " gl_Position = u_matrix * a_position; \n"
39 " v_texcoord = a_texcoord; \n" 41 " v_texcoord = a_texcoord; \n"
40 "}"; 42 "}";
41 43
42 static const char* FRAGMENT_SHADER = 44 static const char* FRAGMENT_SHADER =
45 ORTHANC_STONE_OPENGL_SHADER_VERSION_DIRECTIVE
43 "uniform sampler2D u_texture; \n" 46 "uniform sampler2D u_texture; \n"
44 "uniform vec3 u_color; \n" 47 "uniform vec3 u_color; \n"
45 "varying vec2 v_texcoord; \n" 48 "varying vec2 v_texcoord; \n"
46 "void main() \n" 49 "void main() \n"
47 "{ \n" 50 "{ \n"