Skip to content

Commit

Permalink
Use glow, GL on Whatever (#262)
Browse files Browse the repository at this point in the history
Replaces the use of gl_generator with the glow wrapper:

* Add glow dependency, based on glow 0.6.1

* Pin version of glow fork for iceiix/glow#1 until #442 renderbuffer

* Remove gl module, steven_gl

Porting details:
* Initialize glow in src/gl/mod.rs
* Call gl methods on glow context
* glow uses camelcase
* Import glow::HasContext trait, finds draw_elements etc.
* Fix mismatched types, glow uses Option and &str instead of raw pointers
* Fix uniform_location, glow already returns Some(u32)
* uniform_location: convert i32 to u32 for Uniform
* Fix attribute_location
* Fix shader creation Result u32 type 
* Fix passing GLvoid and 2d/3d
* Fix missing Options type mismatches
* Offsets are i32 in glow, not GLvoid
* Fix clear_buffer using _f32_slice
* Delete methods are singular not plural
* glBufferData -> buffer_data_u8_slice
* buffer_sub_data_u8_slice
* Update more glow method wrapper names found by reviewing glow native platform
* Remove unused multi_draw_elements, can be replaced by draw_elements in a loop and it has no WebGL equivalent
* glow implements glMapBufferRange
* Remove unused read_buffer
* glow's deletes automatically pass 1 and take no reference
* shader_source() accepts &str directly; removes last of std::ptr
* Pass uniform Option<u32>
* Fix bool passing normalized parameter
* Fix draw_buffers parameter
* Stop unnecessarily returning context from gl::init
* Getting shader info is unsafe 
* Unwrapping static mut is unsafe
* Use unsafe raw pointers for global mutable context
* Fix initializing GL objects wrappers from glow wrappers
* Unbinding framebuffers uses None
* Uppercase global to fix warning
* Shaders return Some instead of None
* Unbox the context to a raw pointer
* Use tex_image_2d_multisample added in glow fork 
* Implement uniform_location, fixing unwrap None failed
* Add tex_sub_image_3d, using PixelUnpackData::Slice
* set_matrix4: transmute the Matrix4 since it is repr(C)
* get_pixels -> get_tex_image -> glGetTexImage, with PixelPackData::Slice
* Wrap sub_image_2d (glTexSubImage2D) and fix warnings
* Implement set_float_multi_raw and set_matrix4_multi, using from_raw_parts
  • Loading branch information
iceiix authored Dec 25, 2020
1 parent 9700ffe commit 0aa062f
Show file tree
Hide file tree
Showing 10 changed files with 178 additions and 290 deletions.
28 changes: 18 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ opt-level = 1
cfg-if = "1.0.0"
wasm-bindgen = "0.2.69"
glutin = "0.26.0"
glow = { git = "https://github.com/iceiix/glow", rev = "45c808678735e03737d5e1b9d6ed0e21070edcd9" }
byteorder = "1.3.4"
serde = "1.0.118"
serde_json = "1.0.60"
Expand All @@ -46,10 +47,6 @@ reqwest = { version = "0.10.10", features = [ "blocking" ]}
stdweb = "0.4.20"
winit = { version = "0.24.0", features = [ "stdweb" ]}

[dependencies.steven_gl]
path = "./gl"
version = "0"

[dependencies.steven_resources]
path = "./resources"
version = "0"
Expand Down
56 changes: 0 additions & 56 deletions gl/Cargo.lock

This file was deleted.

13 changes: 0 additions & 13 deletions gl/Cargo.toml

This file was deleted.

15 changes: 0 additions & 15 deletions gl/build.rs

This file was deleted.

4 changes: 0 additions & 4 deletions gl/src/lib.rs

This file was deleted.

Loading

0 comments on commit 0aa062f

Please sign in to comment.