upgraded to webgl2
This commit is contained in:
@ -89,7 +89,7 @@ function bind2DFloat32Data(positions) {
|
||||
function main() {
|
||||
const canvas = document.querySelector("#glcanvas");
|
||||
// Initialize the GL context
|
||||
gl = canvas.getContext("webgl");
|
||||
gl = canvas.getContext("webgl2");
|
||||
|
||||
// Only continue if WebGL is available and working
|
||||
if (gl === null) {
|
||||
@ -106,12 +106,12 @@ function main() {
|
||||
`;
|
||||
const fsSource = `
|
||||
void main() {
|
||||
gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
gl_FragColor = vec4(0, 1.0, 0, 1.0);
|
||||
}
|
||||
`;
|
||||
const shaderProgram = compileLinkProgram(vsSource, fsSource);
|
||||
const positions = [0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, -0.5];
|
||||
|
||||
const vao = bind2DFloat32Data(positions);
|
||||
// Set clear color to black, fully opaqe
|
||||
gl.clearColor(0.0, 0.0, 0.0, 1.0);
|
||||
// Clear the color buffer with specified clear color
|
||||
|
Reference in New Issue
Block a user