diff examples/E10_pong.nim @ 210:f3912838cd69

fix: always use rgba
author Sam <sam@basx.dev>
date Tue, 09 May 2023 18:19:17 +0700
parents 84fd522fdf3f
children 952428f04ffc
line wrap: on
line diff
--- a/examples/E10_pong.nim	Tue May 09 01:37:46 2023 +0700
+++ b/examples/E10_pong.nim	Tue May 09 18:19:17 2023 +0700
@@ -3,10 +3,10 @@
 import semicongine
 
 let
-  barcolor = hexToColor("5A3F00").gamma(2.2).colorToHex()
+  barcolor = hexToColorAlpha("5A3F00").gamma(2.2).colorToHex()
   barSize = 0.1'f
   barWidth = 0.01'f
-  ballcolor = hexToColor("B17F08").gamma(2.2).colorToHex()
+  ballcolor = hexToColorAlpha("B17F08").gamma(2.2).colorToHex()
   ballSize = 0.01'f
   backgroundColor = hexToColorAlpha("FAC034FF").gamma(2.2)
   ballSpeed = 60'f
@@ -33,10 +33,10 @@
   const
     vertexInput = @[
       attr[Vec3f]("position"),
-      attr[Vec3f]("color", memoryPerformanceHint=PreferFastWrite),
+      attr[Vec4f]("color", memoryPerformanceHint=PreferFastWrite),
       attr[Mat4]("transform", memoryPerformanceHint=PreferFastWrite, perInstance=true),
     ]
-    vertexOutput = @[attr[Vec3f]("outcolor")]
+    vertexOutput = @[attr[Vec4f]("outcolor")]
     uniforms = @[attr[Mat4]("projection")]
     fragOutput = @[attr[Vec4f]("color")]
     vertexCode = compileGlslShader(
@@ -51,7 +51,7 @@
       inputs=vertexOutput,
       uniforms=uniforms,
       outputs=fragOutput,
-      main="color = vec4(outcolor, 1);"
+      main="color = outcolor;"
     )
 
   # set up rendering