Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shaders for Android (GLES 2) (#10506)
Shader support for OpenGL ES 2 devices (Android) Co-authored-by: sfan5 <sfan5@live.de>
- Loading branch information
1 parent
33b2c5f
commit 707c8c1
Showing
17 changed files
with
233 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
varying mediump vec2 varTexCoord; | ||
|
||
void main(void) | ||
{ | ||
gl_TexCoord[0] = gl_MultiTexCoord0; | ||
gl_Position = gl_Vertex; | ||
gl_FrontColor = gl_BackColor = gl_Color; | ||
varTexCoord = inTexCoord0; | ||
gl_Position = inVertexPosition; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
varying lowp vec4 varColor; | ||
|
||
void main(void) | ||
{ | ||
gl_FragColor = gl_Color; | ||
gl_FragColor = varColor; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
uniform mat4 mWorldViewProj; | ||
varying lowp vec4 varColor; | ||
|
||
void main(void) | ||
{ | ||
gl_TexCoord[0] = gl_MultiTexCoord0; | ||
gl_Position = mWorldViewProj * gl_Vertex; | ||
|
||
gl_FrontColor = gl_BackColor = gl_Color; | ||
gl_Position = mWorldViewProj * inVertexPosition; | ||
varColor = inVertexColor; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
uniform mat4 mWorldViewProj; | ||
uniform mat4 mWorld; | ||
|
||
varying lowp vec4 varColor; | ||
varying mediump vec2 varTexCoord; | ||
|
||
void main(void) | ||
{ | ||
gl_TexCoord[0] = gl_MultiTexCoord0; | ||
gl_Position = mWorldViewProj * gl_Vertex; | ||
gl_FrontColor = gl_BackColor = gl_Color; | ||
varTexCoord = inTexCoord0.st; | ||
gl_Position = mWorldViewProj * inVertexPosition; | ||
varColor = inVertexColor; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
uniform sampler2D baseTexture; | ||
|
||
varying lowp vec4 varColor; | ||
varying mediump vec2 varTexCoord; | ||
|
||
void main(void) | ||
{ | ||
vec2 uv = gl_TexCoord[0].st; | ||
vec2 uv = varTexCoord.st; | ||
vec4 color = texture2D(baseTexture, uv); | ||
color.rgb *= gl_Color.rgb; | ||
color.rgb *= varColor.rgb; | ||
gl_FragColor = color; | ||
} |
Oops, something went wrong.