1
0
Fork 0
forked from wry/wry

autocommit 2022-02-01 01:20:49 CET

This commit is contained in:
Julian Orth 2022-02-01 01:20:49 +01:00
parent f2117256b9
commit 7654e70f64
39 changed files with 830 additions and 761 deletions

View file

@ -40,9 +40,9 @@ pub const GL_TRIANGLES: GLenum = 0x0004;
pub const GL_UNPACK_ROW_LENGTH_EXT: GLenum = 0x0CF2;
pub const GL_UNSIGNED_BYTE: GLint = 0x1401;
pub const GL_VERTEX_SHADER: GLenum = 0x8B31;
pub const GL_BLEND : GLenum = 0x0BE2;
pub const GL_ONE : GLenum = 1;
pub const GL_ONE_MINUS_SRC_ALPHA : GLenum = 0x0303;
pub const GL_BLEND: GLenum = 0x0BE2;
pub const GL_ONE: GLenum = 1;
pub const GL_ONE_MINUS_SRC_ALPHA: GLenum = 0x0303;
#[link(name = "GLESv2")]
extern "C" {
@ -69,7 +69,7 @@ extern "C" {
);
pub fn glCheckFramebufferStatus(target: GLenum) -> GLenum;
pub fn glClear(mask: GLbitfield);
pub fn glBlendFunc (sfactor: GLenum, dfactor: GLenum);
pub fn glBlendFunc(sfactor: GLenum, dfactor: GLenum);
pub fn glClearColor(red: GLfloat, green: GLfloat, blue: GLfloat, alpha: GLfloat);
#[allow(dead_code)]
pub fn glFlush();

View file

@ -1,15 +1,15 @@
use crate::rect::Rect;
use crate::render::gl::frame_buffer::GlFrameBuffer;
use crate::render::gl::sys::{
glBindFramebuffer, glClear, glClearColor, glViewport, GL_COLOR_BUFFER_BIT, GL_FRAMEBUFFER,
};
use crate::render::renderer::context::RenderContext;
use crate::render::renderer::renderer::Renderer;
use crate::render::sys::{glBlendFunc, GL_ONE, GL_ONE_MINUS_SRC_ALPHA};
use crate::tree::Node;
use crate::State;
use std::ptr;
use std::rc::Rc;
use crate::rect::Rect;
use crate::render::sys::{GL_ONE, GL_ONE_MINUS_SRC_ALPHA, glBlendFunc};
use crate::State;
pub struct Framebuffer {
pub(super) ctx: Rc<RenderContext>,

View file

@ -10,14 +10,14 @@ use crate::render::gl::sys::{
GL_TEXTURE_MIN_FILTER, GL_TRIANGLES, GL_TRIANGLE_STRIP,
};
use crate::render::renderer::context::RenderContext;
use crate::render::sys::{glDisable, glEnable, GL_BLEND};
use crate::tree::{
ContainerFocus, ContainerNode, ContainerSplit, FloatNode, OutputNode,
WorkspaceNode, CONTAINER_BORDER, CONTAINER_TITLE_HEIGHT,
ContainerFocus, ContainerNode, ContainerSplit, FloatNode, OutputNode, WorkspaceNode,
CONTAINER_BORDER, CONTAINER_TITLE_HEIGHT,
};
use std::ops::Deref;
use std::rc::Rc;
use std::slice;
use crate::render::sys::{GL_BLEND, glDisable, glEnable};
const NON_COLOR: (f32, f32, f32) = (0.2, 0.2, 0.2);
const CHILD_COLOR: (f32, f32, f32) = (0.8, 0.8, 0.8);
@ -233,11 +233,11 @@ impl Renderer<'_> {
true => {
glEnable(GL_BLEND);
&self.ctx.tex_alpha_prog
},
}
false => {
glDisable(GL_BLEND);
&self.ctx.tex_prog
},
}
};
glUseProgram(prog.prog.prog);
@ -269,14 +269,7 @@ impl Renderer<'_> {
0,
texcoord.as_ptr() as _,
);
glVertexAttribPointer(
prog.pos as _,
2,
GL_FLOAT,
GL_FALSE,
0,
pos.as_ptr() as _,
);
glVertexAttribPointer(prog.pos as _, 2, GL_FLOAT, GL_FALSE, 0, pos.as_ptr() as _);
glEnableVertexAttribArray(prog.texcoord as _);
glEnableVertexAttribArray(prog.pos as _);