Commit e2b3f0cd8c98aebdbb4b5b324b52860607588591

Authored by Adeel Kazmi
1 parent 475bdc59

ImageViewURL & Styling Examples Launch Fix on GLES 3.2 Devices

- Need to use the defines instead and need to change the shader
  accordingly

Change-Id: I6cce0c4b88e287d250c3d9369ad1deada45fafd5
examples/image-view-url/image-view-url-example.cpp
1 1 /*
2   - * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2021 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -104,7 +104,7 @@ private:
104 104 mActorForInput.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
105 105 mActorForInput.SetProperty(Actor::Property::SIZE, TARGET_SIZE);
106 106 Property::Map customShader;
107   - customShader[Toolkit::Visual::Shader::Property::FRAGMENT_SHADER] = SHADER_IMAGE_VIEW_URL_FRAG.data();
  107 + customShader[Toolkit::Visual::Shader::Property::FRAGMENT_SHADER] = Dali::Shader::GetFragmentShaderPrefix() + SHADER_IMAGE_VIEW_URL_FRAG.data();
108 108 Property::Map visualMap;
109 109 visualMap.Insert(Toolkit::Visual::Property::SHADER, customShader);
110 110 mActorForInput.SetProperty(Toolkit::ImageView::Property::IMAGE, visualMap);
... ...
examples/image-view-url/shaders/image-view-url.frag
1 1 precision highp float;
2   -varying mediump vec2 vTexCoord;
  2 +INPUT mediump vec2 vTexCoord;
3 3 uniform sampler2D sTexture;
4 4 uniform mediump float uDelta;
5 5  
... ... @@ -9,6 +9,6 @@ void main()
9 9 vec2 texCoord = vTexCoord * 2. - 1.;
10 10 mat2 rotation = mat2(cos(uDelta), -sin(uDelta), sin(uDelta), cos(uDelta));
11 11 texCoord = (rotation * texCoord) * .5 + .5;
12   - color += texture2D( sTexture, texCoord );
13   - gl_FragColor = color;
14   -}
15 12 \ No newline at end of file
  13 + color += TEXTURE( sTexture, texCoord );
  14 + OUT_COLOR = color;
  15 +}
... ...
examples/styling/image-channel-control-impl.cpp
1 1 /*
2   - * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2021 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -82,7 +82,7 @@ void ImageChannelControl::SetImage(const std::string& url)
82 82  
83 83 Property::Map properties;
84 84 Property::Map shader;
85   - shader[Dali::Toolkit::Visual::Shader::Property::FRAGMENT_SHADER] = SHADER_IMAGE_CHANNEL_CONTROL_FRAG.data();
  85 + shader[Dali::Toolkit::Visual::Shader::Property::FRAGMENT_SHADER] = Dali::Shader::GetFragmentShaderPrefix() + SHADER_IMAGE_CHANNEL_CONTROL_FRAG.data();
86 86 properties[Dali::Toolkit::Visual::Property::TYPE] = Dali::Toolkit::Visual::IMAGE;
87 87 properties[Dali::Toolkit::Visual::Property::SHADER] = shader;
88 88 properties[Dali::Toolkit::ImageVisual::Property::URL] = url;
... ...
examples/styling/shaders/image-channel-control.frag
1   -varying mediump vec2 vTexCoord;
  1 +INPUT mediump vec2 vTexCoord;
2 2 uniform sampler2D sTexture;
3 3 uniform mediump vec4 uColor;
4 4 uniform mediump vec3 mixColor;
... ... @@ -6,5 +6,5 @@ uniform mediump vec3 uChannels;
6 6  
7 7 void main()
8 8 {
9   - gl_FragColor = texture2D( sTexture, vTexCoord ) * vec4(mixColor,1.0) * uColor * vec4(uChannels, 1.0) ;
  9 + OUT_COLOR = TEXTURE( sTexture, vTexCoord ) * vec4(mixColor,1.0) * uColor * vec4(uChannels, 1.0) ;
10 10 }
... ...