docs and type fixes

This commit is contained in:
Rakarake 2026-03-15 14:49:19 +01:00
parent 641953bba1
commit 4acce5525d
5 changed files with 15 additions and 8 deletions

View file

@ -68,7 +68,7 @@ float limit(float val, float min, float max) {
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 screen_uv = gl_FragCoord.xy / iResolution;
vec2 screen_uv = gl_FragCoord.xy / iResolution.xy;
// We'll make origin in the top-left.
screen_uv.y = 1.0 - screen_uv.y;
screen_uv.x *= iResolution.x / iResolution.y;

View file

@ -1,5 +1,5 @@
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = fragCoord / iResolution;
vec2 uv = fragCoord / iResolution.xy;
uv = vec2(uv.x, 1.0 - uv.y);
// mixes two textures
//fragColor = mix(texture(iChannel0, uv), texture(iChannel1, uv), 0.2);

View file

@ -1,7 +1,7 @@
#define PI 3.1415926538
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = fragCoord / iResolution;
vec2 uv = fragCoord / iResolution.xy;
vec2 lines_uv = uv;

View file

@ -47,9 +47,9 @@ Time since program start.
.RE
.PP
\fBiResolution\fR : vec2
\fBiResolution\fR : vec3
.RS 4
Resolution in (number of pixels) x & y.
Resolution in number of pixels. x: width, y: height, z: aspect-ratio (hard coded to 1.0).
.RE
.PP
@ -59,11 +59,18 @@ The currently rendered frame.
.RE
.PP
\fBiChannel\fR{\fB0\fR..\fB3\fR} : int
\fBiChannel\fR{\fB0\fR..\fB3\fR} : sampler
.RS 4
Samplers for provided textures.
.RE
.PP
\fBiChannelResolution\fR : vec3[4]
.RS 4
Array of resolutions for iChannel:s. x: width, y: height, z: aspect-ratio (hard coded
to 1.0).
.RE
.SH SEE ALSO
\fBwlr-randr\fR(1)
.PP

View file

@ -45,7 +45,7 @@ const char *fragment_header_src =
"precision lowp sampler2D;\n"
"precision lowp samplerCube;\n"
"layout(location = 0) out vec4 color;\n"
"uniform vec2 iResolution;\n"
"uniform vec3 iResolution;\n"
"uniform float iTime;\n"
"uniform int iFrame;\n"
"uniform sampler2D iChannel0;\n"
@ -266,7 +266,7 @@ void render(Renderer *state, int w, int h, double time, char *shader_path, int r
glUniform3fv(uniform_iChannelResolution, state->texture_count, iChannelResolutions);
int uniform_iResolution = glGetUniformLocation(state->shader, "iResolution");
glUniform2f(uniform_iResolution, w, h);
glUniform3f(uniform_iResolution, w, h, 1.0);
int uniform_iTime = glGetUniformLocation(state->shader, "iTime");
glUniform1f(uniform_iTime, (float)time);