Added support for vertex colours

This commit is contained in:
Robert Osfield 2020-11-12 18:35:16 +00:00
parent 8bad3be995
commit 5f03aec6bc
2 changed files with 6 additions and 1 deletions

View File

@ -2,11 +2,13 @@
uniform sampler2D texture;
in vec4 color;
in vec2 texcoord;
out vec4 fragColor;
void main(void)
{
fragColor = texture2D( texture, texcoord.xy);
fragColor = color * texture2D( texture, texcoord.xy);
if (fragColor.a==0.0) discard;
}

View File

@ -12,14 +12,17 @@ uniform mat4 ovr_projectionMatrix[NUM_VIEWS];
uniform mat4 ovr_viewMatrix[NUM_VIEWS];
in vec4 osg_Vertex;
in vec4 osg_Color;
in vec4 osg_MultiTexCoord0;
out vec4 color;
out vec2 texcoord;
void main(void)
{
mat4 mvp = ovr_projectionMatrix[gl_ViewID_OVR] * osg_ProjectionMatrix * ovr_viewMatrix[gl_ViewID_OVR] * osg_ModelViewMatrix;
color = osg_Color;
texcoord = osg_MultiTexCoord0.xy;
gl_Position = mvp * osg_Vertex;