REVIEWED: Ligthmap example
This commit is contained in:
parent
abcbd9817e
commit
5573f0f1c7
4 changed files with 81 additions and 72 deletions
|
@ -1,4 +1,5 @@
|
|||
#version 330
|
||||
|
||||
// Input vertex attributes (from vertex shader)
|
||||
in vec2 fragTexCoord;
|
||||
in vec2 fragTexCoord2;
|
||||
|
@ -12,9 +13,11 @@ uniform sampler2D texture1;
|
|||
// Output fragment color
|
||||
out vec4 finalColor;
|
||||
|
||||
void main() {
|
||||
// Texel color fetching from texture sampler
|
||||
vec4 texelColor = texture( texture0, fragTexCoord );
|
||||
vec4 texelColor2 = texture( texture1, fragTexCoord2 );
|
||||
finalColor = texelColor * texelColor2;
|
||||
void main()
|
||||
{
|
||||
// Texel color fetching from texture sampler
|
||||
vec4 texelColor = texture(texture0, fragTexCoord);
|
||||
vec4 texelColor2 = texture(texture1, fragTexCoord2);
|
||||
|
||||
finalColor = texelColor * texelColor2;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#version 330
|
||||
|
||||
// Input vertex attributes
|
||||
in vec3 vertexPosition;
|
||||
in vec2 vertexTexCoord;
|
||||
|
@ -15,13 +16,14 @@ out vec2 fragTexCoord;
|
|||
out vec2 fragTexCoord2;
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
void main()
|
||||
{
|
||||
// Send vertex attributes to fragment shader
|
||||
fragPosition = vec3( matModel * vec4( vertexPosition, 1.0 ) );
|
||||
fragPosition = vec3(matModel*vec4(vertexPosition, 1.0));
|
||||
fragTexCoord = vertexTexCoord;
|
||||
fragTexCoord2 = vertexTexCoord2;
|
||||
fragColor = vertexColor;
|
||||
|
||||
// Calculate final vertex position
|
||||
gl_Position = mvp * vec4( vertexPosition, 1.0 );
|
||||
gl_Position = mvp*vec4(vertexPosition, 1.0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue