-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Create basic WebGL example #835
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
Conversation
examples/webgl/src/lib.rs
Outdated
source: &str, | ||
) -> Result<WebGlShader, String> { | ||
let shader = context | ||
.create_shader(shader_type as u32) |
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.
incredibly, incredibly minor - but it seems like shader_type
is already a u32
so need for casting?
examples/webgl/src/lib.rs
Outdated
} | ||
} | ||
|
||
#[wasm_bindgen] |
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.
Minor - but what about moving this function to the top of the file since it's the meat of the demo?
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.
Looking good, thanks!
In addition to the nitpicks that @chinedufn pointed out, could you also add a subsection to the guide that shows off this example, similar to guide/src/web-sys/examples/*
. Make sure to also add the new section to guide/src/SUMMARY.md
or else it won't show up.
Thanks a bunch!
6a56d3d
to
3d9f102
Compare
3d9f102
to
426671d
Compare
@chinedufn Good catch on the cast. That's what I get for copying from my other project. ;) I think I've got the guide section in, but let me know if something doesn't look right. |
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.
Looks great! Thanks @blm768 :)
This example doesn't do much, but it gets a triangle on the screen.