Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGL: INVALID_OPERATION: drawArrays: no valid shader program in use #115

Open
jameskolts opened this issue Sep 22, 2021 · 0 comments
Open

Comments

@jameskolts
Copy link

I was simply following the initial documentation to see a trivial example of the canvas in action with WebGL. The provided code throws an Invalid Operation exception with the following message: CanvasContextManager.ts:77 WebGL: INVALID_OPERATION: drawArrays: no valid shader program in use. This error is visible in the browser console and causes the canvas to render as purely black screen.

public partial class GameCanvas 
{
    private WebGLContext _context;

    protected BECanvasComponent _canvasReference;

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        _context = await _canvasReference.CreateWebGLAsync();

        await _context.ClearColorAsync(0, 0, 0, 1);


        await _context.BeginBatchAsync();
        await _context.ClearAsync(BufferBits.COLOR_BUFFER_BIT);
        await _context.DrawArraysAsync(Primitive.TRIANGLES, 0, 3);

        await _context.EndBatchAsync();
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant