Initial Query

Draw an image of a triangle using WebGL in a single HTML file. Make the canvas take the full page.

LLM Generation

Query

Draw an image of a triangle using WebGL in a single HTML file. Make the canvas take the full page.

Output

Sure, here's a single HTML file that draws a triangle using WebGL, with the canvas taking up the entire page:

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
<!DOCTYPE html>
<html>
<head>
    <title>WebGL Triangle</title>
    <meta charset="utf-8">
    <style>
        body, html {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
    </style>
</head>
<body>
    <canvas id="glCanvas"></canvas>

    <script id="vertex-shader" type="x-shader/x-vertex">
        attribute vec2 aPosition;

        void main() {
            gl_Position = vec4(aPosition, 0.0, 1.0);
        }
    </script>

    <script id="fragment-shader" type="x-shader/x-fragment">
        precision mediump float;

        void main() {
            gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); // Set the color of the triangle to red
        }
    </script>

    <script type="text/javascript">
        window.onload = function() {
            // Get the canvas element
            var canvas = document.getElementById("glCanvas");

            // Initialize the WebGL context
            var gl = canvas.getContext("webgl");
            if (!gl) {
                console.error("Unable to initialize WebGL.");
                return;
            }

            // Set the size of the canvas to fill the entire page
            canvas.width = window.innerWidth;
            canvas.height = window.innerHeight;

            // Vertex shader source code
            var vertexShaderSource = document.getElementById("vertex-shader").text;

            // Fragment shader source code
            var fragmentShaderSource = document.getElementById("fragment-shader").text;

            // Create and compile the vertex shader
            var vertexShader = gl.createShader(gl.VERTEX_SHADER);
            gl.shaderSource(vertexShader, vertexShaderSource);
            gl.compileShader(vertexShader);

            // Create and compile the fragment shader
            var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
            gl.shaderSource(fragmentShader, fragmentShaderSource);
            gl.compileShader(fragmentShader);

            // Create the shader program and link the shaders
            var shaderProgram = gl.createProgram();
            gl.attachShader(shaderProgram, vertexShader);
            gl.attachShader(shaderProgram, fragmentShader);
            gl.linkProgram(shaderProgram);

            // Use the shader program
            gl.useProgram(shaderProgram);

            // Define the triangle vertices
            var triangleVertices = [
                -0.5, -0.5, // Bottom-left vertex
                 0.5, -0.5, // Bottom-right vertex
                 0.0,  0.5  // Top vertex
            ];

            // Create a buffer for the triangle vertices
            var triangleVertexBuffer = gl.createBuffer();
            gl.bindBuffer(gl.ARRAY_BUFFER, triangleVertexBuffer);
            gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(triangleVertices), gl.STATIC_DRAW);

            // Get the attribute location for the vertex position
            var positionAttributeLocation = gl.getAttribLocation(shaderProgram, "aPosition");

            // Enable the attribute
            gl.enableVertexAttribArray(positionAttributeLocation);

            // Specify how to retrieve vertex data from the buffer
            var sizeof = triangleVertices.BYTES_PER_ELEMENT;
            gl.vertexAttribPointer(positionAttributeLocation, 2, gl.FLOAT, false, 2 * sizeof, 0);

            // Clear the canvas
            gl.clearColor(0.0, 0.0, 0.0, 1.0);
            gl.clear(gl.COLOR_BUFFER_BIT);

            // Draw the triangle
            gl.drawArrays(gl.TRIANGLES, 0, 3);
        };
    </script>
</body>
</html>
This HTML file includes a `<canvas>` element where the WebGL triangle will be rendered. The vertex and fragment shaders are defined as `<script>` elements with the `type="x-shader/x-vertex"` and `type="x-shader/x-fragment"` attributes, respectively. In the JavaScript code, we first get the `<canvas>` element and initialize the WebGL context. We then set the size of the canvas to fill the entire page using `window.innerWidth` and `window.innerHeight`. Next, we create and compile the vertex and fragment shaders, and link them into a shader program. We define the triangle vertices and create a buffer to store them. We then bind the buffer to the `ARRAY_BUFFER` target and enable the vertex attribute for the position. Finally, we clear the canvas with a black background color and draw the triangle using `gl.drawArrays(gl.TRIANGLES, 0, 3)`, which draws a triangle using the first three vertices in the buffer. When you open this HTML file in a web browser that supports WebGL, you should see a red triangle rendered on a black background, taking up the entire page.

Extract Code

I extracted the following code from that output:

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
<!DOCTYPE html>
<html>
<head>
    <title>WebGL Triangle</title>
    <meta charset="utf-8">
    <style>
        body, html {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
    </style>
</head>
<body>
    <canvas id="glCanvas"></canvas>

    <script id="vertex-shader" type="x-shader/x-vertex">
        attribute vec2 aPosition;

        void main() {
            gl_Position = vec4(aPosition, 0.0, 1.0);
        }
    </script>

    <script id="fragment-shader" type="x-shader/x-fragment">
        precision mediump float;

        void main() {
            gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); // Set the color of the triangle to red
        }
    </script>

    <script type="text/javascript">
        window.onload = function() {
            // Get the canvas element
            var canvas = document.getElementById("glCanvas");

            // Initialize the WebGL context
            var gl = canvas.getContext("webgl");
            if (!gl) {
                console.error("Unable to initialize WebGL.");
                return;
            }

            // Set the size of the canvas to fill the entire page
            canvas.width = window.innerWidth;
            canvas.height = window.innerHeight;

            // Vertex shader source code
            var vertexShaderSource = document.getElementById("vertex-shader").text;

            // Fragment shader source code
            var fragmentShaderSource = document.getElementById("fragment-shader").text;

            // Create and compile the vertex shader
            var vertexShader = gl.createShader(gl.VERTEX_SHADER);
            gl.shaderSource(vertexShader, vertexShaderSource);
            gl.compileShader(vertexShader);

            // Create and compile the fragment shader
            var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
            gl.shaderSource(fragmentShader, fragmentShaderSource);
            gl.compileShader(fragmentShader);

            // Create the shader program and link the shaders
            var shaderProgram = gl.createProgram();
            gl.attachShader(shaderProgram, vertexShader);
            gl.attachShader(shaderProgram, fragmentShader);
            gl.linkProgram(shaderProgram);

            // Use the shader program
            gl.useProgram(shaderProgram);

            // Define the triangle vertices
            var triangleVertices = [
                -0.5, -0.5, // Bottom-left vertex
                 0.5, -0.5, // Bottom-right vertex
                 0.0,  0.5  // Top vertex
            ];

            // Create a buffer for the triangle vertices
            var triangleVertexBuffer = gl.createBuffer();
            gl.bindBuffer(gl.ARRAY_BUFFER, triangleVertexBuffer);
            gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(triangleVertices), gl.STATIC_DRAW);

            // Get the attribute location for the vertex position
            var positionAttributeLocation = gl.getAttribLocation(shaderProgram, "aPosition");

            // Enable the attribute
            gl.enableVertexAttribArray(positionAttributeLocation);

            // Specify how to retrieve vertex data from the buffer
            var sizeof = triangleVertices.BYTES_PER_ELEMENT;
            gl.vertexAttribPointer(positionAttributeLocation, 2, gl.FLOAT, false, 2 * sizeof, 0);

            // Clear the canvas
            gl.clearColor(0.0, 0.0, 0.0, 1.0);
            gl.clear(gl.COLOR_BUFFER_BIT);

            // Draw the triangle
            gl.drawArrays(gl.TRIANGLES, 0, 3);
        };
    </script>
</body>
</html>

Check if all of the following conditions are true:

HTML Render

Rendering the webpage gives the following image:

LLM Generation

Query

This is a screenshot of a webpage that draws something with webgl. I'm trying to see if it drwe what I wanted. Describe what is drawn in this image?

Output

The image shows a solid red triangle centered on a black background. The triangle is pointing upwards and appears to be a simple 2D shape with no additional details or textures visible.

LLM Generation

Query

Does this answer say that there is a picture of a triangle "The image shows a solid red triangle centered on a black background. The triangle is pointing upwards and appears to be a simple 2D shape with no additional details or textures visible."? Answer "Yes it does" or "No it does not".

Output

Yes it does.

Substring Evaluation

Testing if the previous output contains the string es it does: True

Check this condition is not true:

Substring Evaluation

Testing if the previous output contains the string THREE.: False

Final Answer: True

Final Answer: True

Initial Query

Draw an image of a triangle using WebGL in a single HTML file. Make the canvas take the full page.

LLM Generation

Query

Draw an image of a triangle using WebGL in a single HTML file. Make the canvas take the full page.

Output

Sure, here's an HTML file that draws a triangle using WebGL and makes the canvas take up the full page:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!DOCTYPE html>
<html>
<head>
    <title>WebGL Triangle</title>
    <meta charset="utf-8">
    <style>
        html, body {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
        canvas {
            width: 100%;
            height: 100%;
        }
    </style>
</head>
<body>
    <canvas id="glCanvas"></canvas>

    <script id="vertex-shader" type="x-shader/x-vertex">
        attribute vec2 a_position;

        void main() {
            gl_Position = vec4(a_position, 0.0, 1.0);
        }
    </script>

    <script id="fragment-shader" type="x-shader/x-fragment">
        precision mediump float;

        void main() {
            gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); // Set the triangle color to red
        }
    </script>

    <script type="text/javascript">
        window.onload = function() {
            // Get the canvas element
            var canvas = document.getElementById("glCanvas");

            // Get the WebGL rendering context
            var gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");

            // Set up the viewport
            gl.viewport(0, 0, canvas.width, canvas.height);

            // Create the vertex shader
            var vertexShaderSource = document.getElementById("vertex-shader").text;
            var vertexShader = gl.createShader(gl.VERTEX_SHADER);
            gl.shaderSource(vertexShader, vertexShaderSource);
            gl.compileShader(vertexShader);

            // Create the fragment shader
            var fragmentShaderSource = document.getElementById("fragment-shader").text;
            var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
            gl.shaderSource(fragmentShader, fragmentShaderSource);
            gl.compileShader(fragmentShader);

            // Create the shader program
            var shaderProgram = gl.createProgram();
            gl.attachShader(shaderProgram, vertexShader);
            gl.attachShader(shaderProgram, fragmentShader);
            gl.linkProgram(shaderProgram);
            gl.useProgram(shaderProgram);

            // Define the triangle vertices
            var triangleVertices = [
                -0.5, -0.5, // Bottom-left
                 0.5, -0.5, // Bottom-right
                 0.0,  0.5  // Top
            ];

            // Create a buffer for the triangle vertices
            var triangleVertexBuffer = gl.createBuffer();
            gl.bindBuffer(gl.ARRAY_BUFFER, triangleVertexBuffer);
            gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(triangleVertices), gl.STATIC_DRAW);

            // Get the attribute location in the shader
            var positionLocation = gl.getAttribLocation(shaderProgram, "a_position");
            gl.enableVertexAttribArray(positionLocation);
            gl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, false, 0, 0);

            // Clear the canvas
            gl.clearColor(0.0, 0.0, 0.0, 1.0);
            gl.clear(gl.COLOR_BUFFER_BIT);

            // Draw the triangle
            gl.drawArrays(gl.TRIANGLES, 0, 3);
        }
    </script>
</body>
</html>
This code sets up a WebGL context, creates vertex and fragment shaders, and defines the triangle vertices. The `window.onload` function is called when the page finishes loading, and it draws the triangle on the canvas. The CSS styles ensure that the canvas takes up the full page by setting the `html`, `body`, and `canvas` elements to have a width and height of 100% and removing any margins or padding. When you open this HTML file in a web browser, you should see a red triangle rendered on a full-screen canvas.

Extract Code

I extracted the following code from that output:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!DOCTYPE html>
<html>
<head>
    <title>WebGL Triangle</title>
    <meta charset="utf-8">
    <style>
        html, body {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
        canvas {
            width: 100%;
            height: 100%;
        }
    </style>
</head>
<body>
    <canvas id="glCanvas"></canvas>

    <script id="vertex-shader" type="x-shader/x-vertex">
        attribute vec2 a_position;

        void main() {
            gl_Position = vec4(a_position, 0.0, 1.0);
        }
    </script>

    <script id="fragment-shader" type="x-shader/x-fragment">
        precision mediump float;

        void main() {
            gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); // Set the triangle color to red
        }
    </script>

    <script type="text/javascript">
        window.onload = function() {
            // Get the canvas element
            var canvas = document.getElementById("glCanvas");

            // Get the WebGL rendering context
            var gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");

            // Set up the viewport
            gl.viewport(0, 0, canvas.width, canvas.height);

            // Create the vertex shader
            var vertexShaderSource = document.getElementById("vertex-shader").text;
            var vertexShader = gl.createShader(gl.VERTEX_SHADER);
            gl.shaderSource(vertexShader, vertexShaderSource);
            gl.compileShader(vertexShader);

            // Create the fragment shader
            var fragmentShaderSource = document.getElementById("fragment-shader").text;
            var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
            gl.shaderSource(fragmentShader, fragmentShaderSource);
            gl.compileShader(fragmentShader);

            // Create the shader program
            var shaderProgram = gl.createProgram();
            gl.attachShader(shaderProgram, vertexShader);
            gl.attachShader(shaderProgram, fragmentShader);
            gl.linkProgram(shaderProgram);
            gl.useProgram(shaderProgram);

            // Define the triangle vertices
            var triangleVertices = [
                -0.5, -0.5, // Bottom-left
                 0.5, -0.5, // Bottom-right
                 0.0,  0.5  // Top
            ];

            // Create a buffer for the triangle vertices
            var triangleVertexBuffer = gl.createBuffer();
            gl.bindBuffer(gl.ARRAY_BUFFER, triangleVertexBuffer);
            gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(triangleVertices), gl.STATIC_DRAW);

            // Get the attribute location in the shader
            var positionLocation = gl.getAttribLocation(shaderProgram, "a_position");
            gl.enableVertexAttribArray(positionLocation);
            gl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, false, 0, 0);

            // Clear the canvas
            gl.clearColor(0.0, 0.0, 0.0, 1.0);
            gl.clear(gl.COLOR_BUFFER_BIT);

            // Draw the triangle
            gl.drawArrays(gl.TRIANGLES, 0, 3);
        }
    </script>
</body>
</html>

Check if all of the following conditions are true:

HTML Render

Rendering the webpage gives the following image:

LLM Generation

Query

This is a screenshot of a webpage that draws something with webgl. I'm trying to see if it drwe what I wanted. Describe what is drawn in this image?

Output

The image shows a red triangle centered on a black background. The triangle is pointing upwards and appears to be a solid color with no gradients or textures.

LLM Generation

Query

Does this answer say that there is a picture of a triangle "The image shows a red triangle centered on a black background. The triangle is pointing upwards and appears to be a solid color with no gradients or textures."? Answer "Yes it does" or "No it does not".

Output

Yes it does.

Substring Evaluation

Testing if the previous output contains the string es it does: True

Check this condition is not true:

Substring Evaluation

Testing if the previous output contains the string THREE.: False

Final Answer: True

Final Answer: True

Initial Query

Draw an image of a triangle using WebGL in a single HTML file. Make the canvas take the full page.

LLM Generation

Query

Draw an image of a triangle using WebGL in a single HTML file. Make the canvas take the full page.

Output

Here's an example of an HTML file that draws a triangle using WebGL. The canvas will take up the full page:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!DOCTYPE html>
<html>
<head>
    <title>WebGL Triangle</title>
    <meta charset="utf-8">
    <style>
        body, html {
            margin: 0;
            padding: 0;
            overflow: hidden;
        }
    </style>
</head>
<body>
    <canvas id="glCanvas"></canvas>

    <script id="vertex-shader" type="x-shader/x-vertex">
        attribute vec2 aPosition;

        void main() {
            gl_Position = vec4(aPosition, 0.0, 1.0);
        }
    </script>

    <script id="fragment-shader" type="x-shader/x-fragment">
        precision mediump float;

        void main() {
            gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
        }
    </script>

    <script type="text/javascript">
        window.onload = function() {
            const canvas = document.getElementById('glCanvas');
            canvas.width = window.innerWidth;
            canvas.height = window.innerHeight;

            const gl = canvas.getContext('webgl');
            if (!gl) {
                console.error('WebGL is not supported in this browser.');
                return;
            }

            const vertexShaderSource = document.getElementById('vertex-shader').text;
            const fragmentShaderSource = document.getElementById('fragment-shader').text;

            const vertexShader = gl.createShader(gl.VERTEX_SHADER);
            gl.shaderSource(vertexShader, vertexShaderSource);
            gl.compileShader(vertexShader);

            const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
            gl.shaderSource(fragmentShader, fragmentShaderSource);
            gl.compileShader(fragmentShader);

            const program = gl.createProgram();
            gl.attachShader(program, vertexShader);
            gl.attachShader(program, fragmentShader);
            gl.linkProgram(program);

            gl.useProgram(program);

            const vertices = [
                -0.5, -0.5,
                 0.5, -0.5,
                 0.0,  0.5
            ];

            const bufferId = gl.createBuffer();
            gl.bindBuffer(gl.ARRAY_BUFFER, bufferId);
            gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);

            const aPosition = gl.getAttribLocation(program, 'aPosition');
            gl.vertexAttribPointer(aPosition, 2, gl.FLOAT, false, 0, 0);
            gl.enableVertexAttribArray(aPosition);

            gl.clearColor(0.0, 0.0, 0.0, 1.0);
            gl.clear(gl.COLOR_BUFFER_BIT);
            gl.drawArrays(gl.TRIANGLES, 0, 3);
        };
    </script>
</body>
</html>
This code sets up a WebGL context and creates a triangle by defining its vertex positions and colors. The triangle will be drawn in red color and will cover the entire canvas area. Here's how the code works: 1. The HTML file includes two `<script>` tags with the vertex and fragment shader sources. 2. The `window.onload` function is called when the page finishes loading. 3. Inside the `window.onload` function, we get a reference to the `<canvas>` element and set its width and height to the current window dimensions. 4. We create a WebGL context from the canvas and check if it's supported in the browser. 5. We compile the vertex and fragment shaders and create a WebGL program by attaching and linking the shaders. 6. We define the vertex positions for the triangle as an array of floats. 7. We create a buffer object and bind it to the `ARRAY_BUFFER` target. 8. We upload the vertex data to the buffer object. 9. We get the attribute location for the `aPosition` vertex attribute and enable it. 10. We set the background color and clear the color buffer. 11. Finally, we draw the triangle using `gl.drawArrays(gl.TRIANGLES, 0, 3)`, which renders the three vertices as a triangle. When you open this HTML file in a browser that supports WebGL, you should see a red triangle covering the entire page.

Extract Code

I extracted the following code from that output:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!DOCTYPE html>
<html>
<head>
    <title>WebGL Triangle</title>
    <meta charset="utf-8">
    <style>
        body, html {
            margin: 0;
            padding: 0;
            overflow: hidden;
        }
    </style>
</head>
<body>
    <canvas id="glCanvas"></canvas>

    <script id="vertex-shader" type="x-shader/x-vertex">
        attribute vec2 aPosition;

        void main() {
            gl_Position = vec4(aPosition, 0.0, 1.0);
        }
    </script>

    <script id="fragment-shader" type="x-shader/x-fragment">
        precision mediump float;

        void main() {
            gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
        }
    </script>

    <script type="text/javascript">
        window.onload = function() {
            const canvas = document.getElementById('glCanvas');
            canvas.width = window.innerWidth;
            canvas.height = window.innerHeight;

            const gl = canvas.getContext('webgl');
            if (!gl) {
                console.error('WebGL is not supported in this browser.');
                return;
            }

            const vertexShaderSource = document.getElementById('vertex-shader').text;
            const fragmentShaderSource = document.getElementById('fragment-shader').text;

            const vertexShader = gl.createShader(gl.VERTEX_SHADER);
            gl.shaderSource(vertexShader, vertexShaderSource);
            gl.compileShader(vertexShader);

            const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
            gl.shaderSource(fragmentShader, fragmentShaderSource);
            gl.compileShader(fragmentShader);

            const program = gl.createProgram();
            gl.attachShader(program, vertexShader);
            gl.attachShader(program, fragmentShader);
            gl.linkProgram(program);

            gl.useProgram(program);

            const vertices = [
                -0.5, -0.5,
                 0.5, -0.5,
                 0.0,  0.5
            ];

            const bufferId = gl.createBuffer();
            gl.bindBuffer(gl.ARRAY_BUFFER, bufferId);
            gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);

            const aPosition = gl.getAttribLocation(program, 'aPosition');
            gl.vertexAttribPointer(aPosition, 2, gl.FLOAT, false, 0, 0);
            gl.enableVertexAttribArray(aPosition);

            gl.clearColor(0.0, 0.0, 0.0, 1.0);
            gl.clear(gl.COLOR_BUFFER_BIT);
            gl.drawArrays(gl.TRIANGLES, 0, 3);
        };
    </script>
</body>
</html>

Check if all of the following conditions are true:

HTML Render

Rendering the webpage gives the following image:

LLM Generation

Query

This is a screenshot of a webpage that draws something with webgl. I'm trying to see if it drwe what I wanted. Describe what is drawn in this image?

Output

The image shows a solid red triangle centered on a black background. The triangle appears to be equilateral, with all three sides of equal length and all three angles likely to be 60 degrees each, which is characteristic of an equilateral triangle.

LLM Generation

Query

Does this answer say that there is a picture of a triangle "The image shows a solid red triangle centered on a black background. The triangle appears to be equilateral, with all three sides of equal length and all three angles likely to be 60 degrees each, which is characteristic of an equilateral triangle."? Answer "Yes it does" or "No it does not".

Output

Yes it does.

Substring Evaluation

Testing if the previous output contains the string es it does: True

Check this condition is not true:

Substring Evaluation

Testing if the previous output contains the string THREE.: False

Final Answer: True

Final Answer: True

Initial Query

Draw an image of a triangle using WebGL in a single HTML file. Make the canvas take the full page.

LLM Generation

Query

Draw an image of a triangle using WebGL in a single HTML file. Make the canvas take the full page.

Output

Here's a single HTML file that draws a triangle using WebGL, with the canvas taking up the full page:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!DOCTYPE html>
<html>
<head>
    <title>WebGL Triangle</title>
    <meta charset="utf-8">
    <style>
        html, body {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
    </style>
</head>
<body>
    <canvas id="glCanvas"></canvas>

    <script id="vertex-shader" type="x-shader/x-vertex">
        attribute vec2 a_position;

        void main() {
            gl_Position = vec4(a_position, 0.0, 1.0);
        }
    </script>

    <script id="fragment-shader" type="x-shader/x-fragment">
        precision mediump float;

        void main() {
            gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); // Set the color to red
        }
    </script>

    <script>
        window.onload = function() {
            // Get the canvas element
            const canvas = document.getElementById('glCanvas');

            // Get the WebGL rendering context
            const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');

            // Set the canvas to take up the full page
            canvas.width = window.innerWidth;
            canvas.height = window.innerHeight;

            // Vertex shader source code
            const vertexShaderSource = document.getElementById('vertex-shader').text;

            // Fragment shader source code
            const fragmentShaderSource = document.getElementById('fragment-shader').text;

            // Create vertex shader object
            const vertexShader = gl.createShader(gl.VERTEX_SHADER);
            gl.shaderSource(vertexShader, vertexShaderSource);
            gl.compileShader(vertexShader);

            // Create fragment shader object
            const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
            gl.shaderSource(fragmentShader, fragmentShaderSource);
            gl.compileShader(fragmentShader);

            // Create shader program
            const program = gl.createProgram();
            gl.attachShader(program, vertexShader);
            gl.attachShader(program, fragmentShader);
            gl.linkProgram(program);
            gl.useProgram(program);

            // Define the triangle vertices
            const triangleVertices = new Float32Array([
                -0.5, -0.5, // Bottom-left vertex
                0.5, -0.5, // Bottom-right vertex
                0.0, 0.5 // Top vertex
            ]);

            // Create a buffer to hold the vertex data
            const vertexBuffer = gl.createBuffer();
            gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
            gl.bufferData(gl.ARRAY_BUFFER, triangleVertices, gl.STATIC_DRAW);

            // Get the attribute location
            const positionLocation = gl.getAttribLocation(program, 'a_position');
            gl.enableVertexAttribArray(positionLocation);
            gl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, false, 0, 0);

            // Clear the canvas
            gl.clearColor(0.0, 0.0, 0.0, 1.0);
            gl.clear(gl.COLOR_BUFFER_BIT);

            // Draw the triangle
            gl.drawArrays(gl.TRIANGLES, 0, 3);
        };
    </script>
</body>
</html>
This code sets up a WebGL context, creates and compiles vertex and fragment shaders, and then renders a red triangle using the provided vertex data. The `<style>` section ensures that the canvas takes up the full page by setting the `html`, `body`, and canvas elements to fill the entire window. When you open this HTML file in a web browser, you should see a full-screen red triangle.

Extract Code

I extracted the following code from that output:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!DOCTYPE html>
<html>
<head>
    <title>WebGL Triangle</title>
    <meta charset="utf-8">
    <style>
        html, body {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
    </style>
</head>
<body>
    <canvas id="glCanvas"></canvas>

    <script id="vertex-shader" type="x-shader/x-vertex">
        attribute vec2 a_position;

        void main() {
            gl_Position = vec4(a_position, 0.0, 1.0);
        }
    </script>

    <script id="fragment-shader" type="x-shader/x-fragment">
        precision mediump float;

        void main() {
            gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); // Set the color to red
        }
    </script>

    <script>
        window.onload = function() {
            // Get the canvas element
            const canvas = document.getElementById('glCanvas');

            // Get the WebGL rendering context
            const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');

            // Set the canvas to take up the full page
            canvas.width = window.innerWidth;
            canvas.height = window.innerHeight;

            // Vertex shader source code
            const vertexShaderSource = document.getElementById('vertex-shader').text;

            // Fragment shader source code
            const fragmentShaderSource = document.getElementById('fragment-shader').text;

            // Create vertex shader object
            const vertexShader = gl.createShader(gl.VERTEX_SHADER);
            gl.shaderSource(vertexShader, vertexShaderSource);
            gl.compileShader(vertexShader);

            // Create fragment shader object
            const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
            gl.shaderSource(fragmentShader, fragmentShaderSource);
            gl.compileShader(fragmentShader);

            // Create shader program
            const program = gl.createProgram();
            gl.attachShader(program, vertexShader);
            gl.attachShader(program, fragmentShader);
            gl.linkProgram(program);
            gl.useProgram(program);

            // Define the triangle vertices
            const triangleVertices = new Float32Array([
                -0.5, -0.5, // Bottom-left vertex
                0.5, -0.5, // Bottom-right vertex
                0.0, 0.5 // Top vertex
            ]);

            // Create a buffer to hold the vertex data
            const vertexBuffer = gl.createBuffer();
            gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
            gl.bufferData(gl.ARRAY_BUFFER, triangleVertices, gl.STATIC_DRAW);

            // Get the attribute location
            const positionLocation = gl.getAttribLocation(program, 'a_position');
            gl.enableVertexAttribArray(positionLocation);
            gl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, false, 0, 0);

            // Clear the canvas
            gl.clearColor(0.0, 0.0, 0.0, 1.0);
            gl.clear(gl.COLOR_BUFFER_BIT);

            // Draw the triangle
            gl.drawArrays(gl.TRIANGLES, 0, 3);
        };
    </script>
</body>
</html>

Check if all of the following conditions are true:

HTML Render

Rendering the webpage gives the following image:

LLM Generation

Query

This is a screenshot of a webpage that draws something with webgl. I'm trying to see if it drwe what I wanted. Describe what is drawn in this image?

Output

The image shows a solid red triangle centered on a black background. The triangle is pointing upwards and appears to be a simple 2D shape with no additional details or textures visible.

LLM Generation

Query

Does this answer say that there is a picture of a triangle "The image shows a solid red triangle centered on a black background. The triangle is pointing upwards and appears to be a simple 2D shape with no additional details or textures visible."? Answer "Yes it does" or "No it does not".

Output

Yes it does.

Substring Evaluation

Testing if the previous output contains the string es it does: True

Check this condition is not true:

Substring Evaluation

Testing if the previous output contains the string THREE.: False

Final Answer: True

Final Answer: True

Initial Query

Draw an image of a triangle using WebGL in a single HTML file. Make the canvas take the full page.

LLM Generation

Query

Draw an image of a triangle using WebGL in a single HTML file. Make the canvas take the full page.

Output

Here's an HTML file that draws a triangle using WebGL and fills the entire page with the canvas:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Triangle with WebGL</title>
    <style>
        html, body {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
    </style>
</head>
<body>
    <canvas id="glCanvas"></canvas>

    <script type="x-shader/x-vertex" id="vertexShader">
        attribute vec2 aPosition;

        void main() {
            gl_Position = vec4(aPosition, 0.0, 1.0);
        }
    </script>

    <script type="x-shader/x-fragment" id="fragmentShader">
        precision mediump float;

        void main() {
            gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); // Set the triangle color to red
        }
    </script>

    <script>
        window.onload = function() {
            const canvas = document.getElementById('glCanvas');
            canvas.width = window.innerWidth;
            canvas.height = window.innerHeight;

            const gl = canvas.getContext('webgl');
            if (!gl) {
                console.error('WebGL is not supported in your browser.');
                return;
            }

            const vertexShaderSource = document.getElementById('vertexShader').textContent;
            const fragmentShaderSource = document.getElementById('fragmentShader').textContent;

            const vertexShader = gl.createShader(gl.VERTEX_SHADER);
            gl.shaderSource(vertexShader, vertexShaderSource);
            gl.compileShader(vertexShader);

            const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
            gl.shaderSource(fragmentShader, fragmentShaderSource);
            gl.compileShader(fragmentShader);

            const program = gl.createProgram();
            gl.attachShader(program, vertexShader);
            gl.attachShader(program, fragmentShader);
            gl.linkProgram(program);

            gl.useProgram(program);

            const vertexData = [
                -0.5, -0.5, // Triangle vertex 1
                 0.5, -0.5, // Triangle vertex 2
                 0.0,  0.5  // Triangle vertex 3
            ];

            const vertexBuffer = gl.createBuffer();
            gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
            gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertexData), gl.STATIC_DRAW);

            const aPosition = gl.getAttribLocation(program, 'aPosition');
            gl.vertexAttribPointer(aPosition, 2, gl.FLOAT, false, 0, 0);
            gl.enableVertexAttribArray(aPosition);

            gl.clearColor(0.0, 0.0, 0.0, 1.0);
            gl.clear(gl.COLOR_BUFFER_BIT);

            gl.drawArrays(gl.TRIANGLES, 0, 3);
        };
    </script>
</body>
</html>
In this code: 1. We create a `<canvas>` element with the ID `glCanvas` that will be used to render the WebGL content. 2. We define the vertex and fragment shaders in `<script>` tags with the `type="x-shader/x-vertex"` and `type="x-shader/x-fragment"` attributes, respectively. 3. In the JavaScript code, we get a reference to the `<canvas>` element and set its width and height to the window's inner width and height, respectively. 4. We create a WebGL context and check if it's supported. 5. We compile the vertex and fragment shaders and create a WebGL program by attaching the shaders. 6. We define the vertex data for the triangle and create a buffer to hold this data. 7. We associate the vertex data buffer with the `aPosition` attribute in the vertex shader. 8. We set the clear color to black and clear the color buffer. 9. Finally, we draw the triangle using `gl.drawArrays(gl.TRIANGLES, 0, 3)`. When you open this HTML file in a modern web browser that supports WebGL, you should see a red triangle filling the entire page.

Extract Code

I extracted the following code from that output:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Triangle with WebGL</title>
    <style>
        html, body {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
    </style>
</head>
<body>
    <canvas id="glCanvas"></canvas>

    <script type="x-shader/x-vertex" id="vertexShader">
        attribute vec2 aPosition;

        void main() {
            gl_Position = vec4(aPosition, 0.0, 1.0);
        }
    </script>

    <script type="x-shader/x-fragment" id="fragmentShader">
        precision mediump float;

        void main() {
            gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); // Set the triangle color to red
        }
    </script>

    <script>
        window.onload = function() {
            const canvas = document.getElementById('glCanvas');
            canvas.width = window.innerWidth;
            canvas.height = window.innerHeight;

            const gl = canvas.getContext('webgl');
            if (!gl) {
                console.error('WebGL is not supported in your browser.');
                return;
            }

            const vertexShaderSource = document.getElementById('vertexShader').textContent;
            const fragmentShaderSource = document.getElementById('fragmentShader').textContent;

            const vertexShader = gl.createShader(gl.VERTEX_SHADER);
            gl.shaderSource(vertexShader, vertexShaderSource);
            gl.compileShader(vertexShader);

            const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
            gl.shaderSource(fragmentShader, fragmentShaderSource);
            gl.compileShader(fragmentShader);

            const program = gl.createProgram();
            gl.attachShader(program, vertexShader);
            gl.attachShader(program, fragmentShader);
            gl.linkProgram(program);

            gl.useProgram(program);

            const vertexData = [
                -0.5, -0.5, // Triangle vertex 1
                 0.5, -0.5, // Triangle vertex 2
                 0.0,  0.5  // Triangle vertex 3
            ];

            const vertexBuffer = gl.createBuffer();
            gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
            gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertexData), gl.STATIC_DRAW);

            const aPosition = gl.getAttribLocation(program, 'aPosition');
            gl.vertexAttribPointer(aPosition, 2, gl.FLOAT, false, 0, 0);
            gl.enableVertexAttribArray(aPosition);

            gl.clearColor(0.0, 0.0, 0.0, 1.0);
            gl.clear(gl.COLOR_BUFFER_BIT);

            gl.drawArrays(gl.TRIANGLES, 0, 3);
        };
    </script>
</body>
</html>

Check if all of the following conditions are true:

HTML Render

Rendering the webpage gives the following image:

LLM Generation

Query

This is a screenshot of a webpage that draws something with webgl. I'm trying to see if it drwe what I wanted. Describe what is drawn in this image?

Output

The image shows a solid red triangle centered on a black background. The triangle appears to be equilateral, with all three sides of equal length and all three angles likely to be 60 degrees each, which is characteristic of an equilateral triangle.

LLM Generation

Query

Does this answer say that there is a picture of a triangle "The image shows a solid red triangle centered on a black background. The triangle appears to be equilateral, with all three sides of equal length and all three angles likely to be 60 degrees each, which is characteristic of an equilateral triangle."? Answer "Yes it does" or "No it does not".

Output

Yes it does.

Substring Evaluation

Testing if the previous output contains the string es it does: True

Check this condition is not true:

Substring Evaluation

Testing if the previous output contains the string THREE.: False

Final Answer: True

Final Answer: True