Skip to content
Permalink
Browse files
Implement WebGL scissor method
  • Loading branch information
dzbarsky committed Dec 16, 2015
1 parent 59a3544 commit 6a72d4dd128f18c5ff027f363fed51a7fad4531c
@@ -111,6 +111,8 @@ impl WebGLPaintTask {
gl::pixel_store_i(name, val),
CanvasWebGLMsg::PolygonOffset(factor, units) =>
gl::polygon_offset(factor, units),
CanvasWebGLMsg::Scissor(x, y, width, height) =>
gl::scissor(x, y, width, height),
CanvasWebGLMsg::EnableVertexAttribArray(attrib_id) =>
gl::enable_vertex_attrib_array(attrib_id),
CanvasWebGLMsg::GetAttribLocation(program_id, name, chan) =>
@@ -175,6 +175,7 @@ pub enum CanvasWebGLMsg {
GetAttribLocation(u32, String, IpcSender<Option<i32>>),
GetUniformLocation(u32, String, IpcSender<Option<i32>>),
PolygonOffset(f32, f32),
Scissor(i32, i32, i32, i32),
Hint(u32, u32),
LineWidth(f32),
PixelStorei(u32, i32),
@@ -906,6 +906,13 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
.unwrap()
}

// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.4
fn Scissor(&self, x: i32, y: i32, width: i32, height: i32) {
self.ipc_renderer
.send(CanvasMsg::WebGL(CanvasWebGLMsg::Scissor(x, y, width, height)))
.unwrap()
}

// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
fn LinkProgram(&self, program: Option<&WebGLProgram>) {
if let Some(program) = program {
@@ -618,7 +618,7 @@ interface WebGLRenderingContextBase
//void renderbufferStorage(GLenum target, GLenum internalformat,
// GLsizei width, GLsizei height);
//void sampleCoverage(GLclampf value, GLboolean invert);
//void scissor(GLint x, GLint y, GLsizei width, GLsizei height);
void scissor(GLint x, GLint y, GLsizei width, GLsizei height);

void shaderSource(WebGLShader? shader, DOMString source);

0 comments on commit 6a72d4d

Please sign in to comment.