Skip to content

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

Merged
merged 1 commit into from
Sep 19, 2018
Merged

Conversation

blm768
Copy link
Contributor

@blm768 blm768 commented Sep 16, 2018

This example doesn't do much, but it gets a triangle on the screen.

source: &str,
) -> Result<WebGlShader, String> {
let shader = context
.create_shader(shader_type as u32)
Copy link
Contributor

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?

}
}

#[wasm_bindgen]
Copy link
Contributor

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?

Copy link
Member

@fitzgen fitzgen left a 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!

@blm768
Copy link
Contributor Author

blm768 commented Sep 18, 2018

@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.

Copy link
Member

@fitzgen fitzgen left a 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 :)

@alexcrichton alexcrichton merged commit 4ca187c into rustwasm:master Sep 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants