popraw uklad i jakies literowki jak sa <!DOCTYPE html> <html> <head>…
- User
popraw uklad i jakies literowki jak sa
window.onload = () => { const aMyWebGL = new MyWebGL(); // Retrieve element const aCanvas = document.getElementById("id_Canvas"); // Get the rendering context for WebGL const gl = aMyWebGL.initGL(aCanvas, true); if (!gl) { console.error("Failed to get the rendering context for WebGL"); return; } const aProgram = aMyWebGL.initShadersAndMakeCurrent(astrVertexShader, astrFragmentShader); if (!aProgram) { console.error("!aProgram"); return; } const a_Position = gl.getAttribLocation(aProgram, "a_Position"); if (0 > a_Position) { console.error("Failed to get the storage location of a_Position"); return; } const a_PointSize = gl.getAttribLocation(aProgram, "a_PointSize"); if (0 > a_PointSize) { console.error("Failed to get the storage location of a_PointSize"); return; }
// Get the storage location of u_FragColorconst u_FragColor = gl.getUniformLocation(aProgram, "u_FragColor"); if (!u_FragColor) { console.error("Failed to get the storage location of u_FragColor"); return; }
// Pass vertex position to attribute variable gl.vertexAttrib3f(a_Position, 0.5, 0.0, 0.0); gl.vertexAttrib1f(a_PointSize, 15.0);
// Pass the color of a point to u_FragColor variable gl.uniform4f(u_FragColor, 0.0, 1.0, 0.0, 1.0);
// Set clear color gl.clearColor(0.0, 0.0, 0.0, 1.0); gl.clear(gl.COLOR_BUFFER_BIT);
// Draw a point gl.drawArrays(gl.POINTS, 0, 1); }
- Assistant
- User
ale troche ci sie rozjechal ten uklad widzisz
- Assistant