-
-
Notifications
You must be signed in to change notification settings - Fork 483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding the new createShader example #6134 #1364
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making this! I just left some minor formatting comments, otherwise this is a cool example!
Just to double-check, @limzykenneth are these files all we need to add to the examples page?
`; | ||
|
||
|
||
let canvas; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think from here to line 110 everything is indented an extra time, do you mind de-indenting this part?
|
||
let screenSize; | ||
let samples; | ||
let targetC; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be good adding a comment on targetC
and currentC
explaining what they'll be used for (how they relate to the c
we pass into the shader, and probably the fact that it's two components because it's a complex number)
// Check to see how many iterations it takes for Z to be greater than the value 3 and setting it a colour accordingly, | ||
for (int i = 0; i < iter_cap; ++i) { | ||
if (dot(z, z) > 3.0) { | ||
// If the series escapes, we calculatae 'value based on the iteration number of iterations it took that value to escape |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tiny changes here: calculate
has a typo, and did you want to say 'value'
in quotes here to match line 64?
// Define the screen size as a 2D vector | ||
vec2 screenSize = vec2(710.0, 400.0); | ||
// Get normalized screen space coordinates for the current pixel, | ||
vec2 normd_pixel = (gl_FragCoord.xy/screenSize - 0.5) * 2.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Uniforms are data that is the same for all pixels processed by the shader. | ||
uniform vec2 c; // Complex number for fractal calculation | ||
uniform vec2 screenSize; // Dimensions of the screen | ||
uniform float hue; // Color hue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this goes unused, maybe we can take it out or make use of it?
Thanks @thantr for working on it. We'd like to follow up on this PR. Please let us know if you need any support responding to @davepagurek's comments. Thank you. |
for issue #6134
Changes:
Added the new createshader/Julia set example to the EN, ES, zh-Hans folders