From 5f03aec6bc21f6d9cb3e0daa4622d093d7e22ac6 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 12 Nov 2020 18:35:16 +0000 Subject: [PATCH] Added support for vertex colours --- examples/osgmultiviewOVR/multiviewOVR.frag | 4 +++- examples/osgmultiviewOVR/multiviewOVR.vert | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/osgmultiviewOVR/multiviewOVR.frag b/examples/osgmultiviewOVR/multiviewOVR.frag index 19b4e006d..7f4d05d18 100644 --- a/examples/osgmultiviewOVR/multiviewOVR.frag +++ b/examples/osgmultiviewOVR/multiviewOVR.frag @@ -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; } diff --git a/examples/osgmultiviewOVR/multiviewOVR.vert b/examples/osgmultiviewOVR/multiviewOVR.vert index bca31aeb4..79e8164dd 100644 --- a/examples/osgmultiviewOVR/multiviewOVR.vert +++ b/examples/osgmultiviewOVR/multiviewOVR.vert @@ -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;