[Pas2js] Case statement bug
Ryan Joseph
ryan at thealchemistguild.com
Fri May 18 15:28:35 CEST 2018
The report was closed so here’s a full file even though you just need to copy and paste that function into any file with WebGL included.
program Bug;
uses
BrowserConsole, Web, WebGL, JS;
procedure GLEnumTest (gl: TJSWebGLRenderingContext);
var
error: integer;
begin
error := gl.getError();
if error <> gl.NO_ERROR then
begin
if error = gl.INVALID_VALUE then
writeln('this works');
case error of
gl.INVALID_VALUE: // <------- Constant expression expected
messageString := messageString+' (GL_INVALID_VALUE)';
gl.INVALID_OPERATION:
messageString := messageString+' (GL_INVALID_OPERATION)';
gl.INVALID_ENUM:
messageString := messageString+' (GL_INVALID_ENUM)';
end;
Fatal(messageString);
end;
end;
var
canvas: TJSHTMLCanvasElement;
begin
canvas := TJSHTMLCanvasElement(document.createElement('canvas'));
canvas.width := 300;
canvas.height := 300;
document.body.appendChild(canvas);
gl := TJSWebGLRenderingContext(canvas.getContext('webgl'));
GLEnumTest(gl);
end.
Regards,
Ryan Joseph
More information about the Pas2js
mailing list