WebGLRenderingContext: lineWidth() method

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Note: This feature is available in Web Workers.

Phương thức WebGLRenderingContext.lineWidth() của WebGL API thiết lập độ rộng đường của các đường rasterized.

Cú pháp

js
lineWidth(width)

Thông số

width

A GLfloat chỉ định độ rộng của các đường rasterized. Giá trị mặc định: 1.

Giá trị trả về

Không có (undefined).

Ví dụ

Thiết lập độ rộng dòng:

js
gl.lineWidth(5);

Lấy chiều rộng của dòng:

js
gl.getParameter(gl.LINE_WIDTH);

Lấy phạm vi chiều rộng có sẵn. Trả về Float32Array.

js
gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE);

Thông số kỹ thuật

Specification
WebGL Specification
# 5.14.3

Khả năng tương thích của trình duyệt

Xem thêm