Skip to content

Commit c5d07a9

Browse files
committed
fixed issue where example graphic was positioned in the corner of the sketch. also added describe() and a small amount of text.
1 parent 22160e0 commit c5d07a9

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/data/examples/assets/uniforms.frag

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ vec4 poly(float x, float y, float size, float sides, float rotation, vec3 col){
5454

5555
void main() {
5656

57-
vec2 center = resolution * 1.0; // draw the shape at the center of the screen
57+
vec2 center = resolution * 0.5; // draw the shape at the center of the screen
5858
float size = resolution.y * 0.5; // make the shape a quarter of the screen height
5959
float sides = mod(floor(mouse), 7.0) + 3.0; // slowly increase the sides, when it reaches 10 sides, go back down to 3
6060
float rotation = time; // rotation is in radians, but for time it doesnt really matter

src/data/examples/en/20_3D/10_passing_shader_uniforms.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@
1717
// shaders require WEBGL mode to work
1818
createCanvas(710, 400, WEBGL);
1919
noStroke();
20+
21+
describe('a 2d example containing a sage green polygon, rotating in the middle of the sketch. As the mouse moves horizontally, the number of sides for the polygon change.')
2022
}
2123

2224
function draw() {
2325
// shader() sets the active shader with our shader
2426
shader(theShader);
2527

2628
// lets send the resolution, mouse, and time to our shader
29+
// the mouse x position will change the number of sides
2730
// before sending mouse + time we modify the data so it's more easily usable by the shader
2831
theShader.setUniform('resolution', [width, height]);
2932
theShader.setUniform('mouse', map(mouseX, 0, width, 0, 7));

0 commit comments

Comments
 (0)