Skip to content
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

Depth test API + examples #29

Merged
merged 6 commits into from Jun 13, 2020
Merged

Conversation

Ratysz
Copy link
Contributor

@Ratysz Ratysz commented Jun 10, 2020

Addresses #19. I'm not an expert on 3D graphics by any means, so don't take it as "the correct thing" right away - it might be but I have no way of knowing.

Copy link
Owner

@ryanisaacg ryanisaacg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is crystal clear, well-documented, and fits in with the rest of the API. I'm extremely grateful, especially because I don't have a lot of experience with depth-testing.

Thanks so much!

@Ratysz
Copy link
Contributor Author

Ratysz commented Jun 15, 2020

I somehow failed to account for web: Context::set_depth_test_mode() will panic with either web_sys or stdweb, due to f64 depth range not being supported in glow for them (web_sys, stdweb).

The reason I chose f64 over f32 is that, apparently, f32 range is not supported in OpenGL until version 4.1 (spec page).

From what I gather, both libraries use WebGL, which is more or less OpenGL ES, which only has f32 range (spec page).

One solution could be to makeDepthTestMode::range_near and DepthTestMode::range_far both f32, and use either glow::HasContext::depth_range_f32() or glow::HasContext::depth_range_f64() depending on target platform.

@ryanisaacg
Copy link
Owner

I think using f32 for both makes sense, would you be up to make a PR to fix it?

@Ratysz Ratysz mentioned this pull request Jun 16, 2020
leod pushed a commit to leod/golem that referenced this pull request Jun 3, 2023
* Implemented POC depth testing:

`depth` module with `DepthTestMode`, `DepthTestFunction`,
`Context::set_depth_test_mode()`; depth test example.

* Documented depth test API.

* Added `DepthTestMode::depth_mask`.

* Fixed `depth` example.

* Derives on `depth` types, minor example tweak.

* Added `3d_scene` example.
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.

None yet

2 participants