Fix typos

This commit is contained in:
Ne_Eo
2024-12-10 04:35:32 +01:00
parent da717919ba
commit d6dc3ea232
76 changed files with 214 additions and 211 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
## Here are guides on common mistakes and advices for writting shaders for flixel and openfl.
## Here are guides on common mistakes and advices for writing shaders for flixel and openfl.
It's important to follow this guide as most shader coders make these mistakes a lot and end up with shaders that only work on certain devices.
@@ -51,7 +51,7 @@ We will show each step to converting this shader into an usable openfl/flixel sh
1. replace ``void mainImage( out vec4 fragColor, in vec2 fragCoord )`` with a simple ``void main()`` (flixel and openfl do not have any parameters since the coords are defined outside the function)
2. replace ``vec2 uv = fragCoord/iResolution.xy;`` with ``vec2 uv = openfl_TextureCoordv`` (or in some cases, add ``vec2 fragCoord = openfl_TextureCoordv*openfl_TextureSize.xy`` before it and replace `iResolution.xy` with ``openfl_TextureSize.xy`` (if the uv value is different than usual))
3. replace ``vec4 col = texture(iChannel0, uv);`` with ``vec4 col = texture2D(bitmap, uv);`` or ``vec4 col = flixel_texture2D(bitmap, uv);`` (keep in mind bitmap is the pixels of the camera/sprite the shader is aplied to)
3. replace ``vec4 col = texture(iChannel0, uv);`` with ``vec4 col = texture2D(bitmap, uv);`` or ``vec4 col = flixel_texture2D(bitmap, uv);`` (keep in mind bitmap is the pixels of the camera/sprite the shader is applied to)
4. finally, replace ``fragColor = col;`` with ``gl_FragColor = col;``
###### Keep in mind that this covers the most basic on how to convert a shader from shadertoy.com, complex shaders will need more expertise with handling shaders before converting those.