From 38885185759271ffaabcc24cad8b9c4614ee3b00 Mon Sep 17 00:00:00 2001 From: Arisotura Date: Wed, 10 Apr 2019 23:47:58 +0200 Subject: here, have vertex colors --- src/GPU3D_OpenGL43.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/GPU3D_OpenGL43.cpp') diff --git a/src/GPU3D_OpenGL43.cpp b/src/GPU3D_OpenGL43.cpp index b4a07d3..aab8e01 100644 --- a/src/GPU3D_OpenGL43.cpp +++ b/src/GPU3D_OpenGL43.cpp @@ -69,6 +69,9 @@ PFNGLDELETEPROGRAMPROC glDeleteProgram; const char* kRenderVS = R"(#version 400 layout(location=0) in uvec4 vPosition; +layout(location=1) in uvec4 vColor; + +smooth out vec4 fColor; void main() { @@ -79,7 +82,7 @@ void main() fpos.z = 0.5; fpos.w = 1.0; - //if (fpos.y < 0.0) fpos.y = -fpos.y; + fColor = vec4(vColor) / vec4(255.0,255.0,255.0,31.0); gl_Position = fpos; } @@ -87,13 +90,18 @@ void main() const char* kRenderFS = R"(#version 400 +smooth in vec4 fColor; + out vec4 oColor; void main() { - vec4 finalcolor = vec4(0, 63.0/255.0, 63.0/255.0, 31.0/255.0); + vec4 finalcolor; + + finalcolor.rgb = fColor.rgb; + finalcolor.a = 1.0; - oColor = finalcolor.bgra; + oColor = finalcolor.bgra * vec4(63.0/255.0, 63.0/255.0, 63.0/255.0, 31.0/255.0); } )"; -- cgit v1.2.3