Skip to content

Program link failure #321

@UlyssesZh

Description

@UlyssesZh

This GL program works on the browser, but does not work with headless-gl. Maybe a bug?

import createGl from 'gl';

const gl = createGl(64, 64);

const vertexShader = gl.createShader(gl.VERTEX_SHADER);
gl.shaderSource(vertexShader, `
	uniform vec4 someUniform;
	void main(void) {
		gl_Position = vec4(1.0);
	}
`);
gl.compileShader(vertexShader);
if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) {
	console.error('vertex compile error');
}

const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
gl.shaderSource(fragmentShader, `
	precision mediump float;
	uniform vec4 someUniform;
	void main(){
		gl_FragColor = vec4(1.0);
	}
`);
gl.compileShader(fragmentShader);
if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) {
	console.error('fragment compile error');
}

const program = gl.createProgram();
gl.attachShader(program, vertexShader);
gl.attachShader(program, fragmentShader);
gl.linkProgram(program);
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
	console.error('link error'); // !
	console.error('program info log:', gl.getProgramInfoLog(program)); // empty
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions