Be consistent with OpenGL coords, buffer[0] being the bottom left

This commit is contained in:
shivshank 2018-08-24 18:13:40 -04:00
parent cac568542a
commit 883b69f9c5
2 changed files with 9 additions and 9 deletions

View file

@ -99,12 +99,12 @@ pub fn init_framebuffer(
VertexFormat::declare(0); VertexFormat::declare(0);
let verts: [[f32; 2]; 12] = [ let verts: [[f32; 2]; 12] = [
[-1., 1.], [0., 0.], // top left [-1., 1.], [0., 1.], // top left
[-1., -1.], [0., 1.], // bottom left [-1., -1.], [0., 0.], // bottom left
[1., -1.], [1., 1.], // bottom right [1., -1.], [1., 0.], // bottom right
[1., -1.], [1., 1.], // bottom right [1., -1.], [1., 0.], // bottom right
[1., 1.], [1., 0.], // top right [1., 1.], [1., 1.], // top right
[-1., 1.], [0., 0.], // top left [-1., 1.], [0., 1.], // top left
]; ];
use std::mem::size_of_val; use std::mem::size_of_val;
gl::BufferData(gl::ARRAY_BUFFER, gl::BufferData(gl::ARRAY_BUFFER,

View file

@ -16,7 +16,7 @@
//! } //! }
//! ``` //! ```
//! //!
//! The default buffer format is 32bit RGBA, so every pixel is four bytes. Buffer[0] is the top //! The default buffer format is 32bit RGBA, so every pixel is four bytes. Buffer[0] is the bottom
//! left pixel. The buffer should be tightly packed with no padding after each row. //! left pixel. The buffer should be tightly packed with no padding after each row.
//! //!
//! # Interlude: Library philosophy //! # Interlude: Library philosophy
@ -213,8 +213,8 @@ impl MiniGlFb {
/// ///
/// The output color is determined by the value of the first output parameter, `r_frag_color`. /// The output color is determined by the value of the first output parameter, `r_frag_color`.
/// Your buffer is accessible as a 2D sampler uniform named `u_buffer`. The first input /// Your buffer is accessible as a 2D sampler uniform named `u_buffer`. The first input
/// parameter `v_uv` is a vec2 UV coordinate. UV (0, 0) represents the upper left of the screen /// parameter `v_uv` is a vec2 UV coordinate. UV (0, 0) represents the bottom left of the
/// and (1, 1) represents the bottom right. /// screen and (1, 1) represents the top right.
/// ///
/// An API for exposing more built in and custom uniforms is planned, along with support for /// An API for exposing more built in and custom uniforms is planned, along with support for
/// an arbitrary number of render targets and possibly more user supplied textures. /// an arbitrary number of render targets and possibly more user supplied textures.