Skip to content

Instantly share code, notes, and snippets.

@arielm
Created November 19, 2021 10:20
Show Gist options
  • Select an option

  • Save arielm/bcd74cc210c18ccae76c8c17eb597623 to your computer and use it in GitHub Desktop.

Select an option

Save arielm/bcd74cc210c18ccae76c8c17eb597623 to your computer and use it in GitHub Desktop.
Testing OpenGL instancing for emscripten / WebGL1
#include <stdio.h>
#include <stdlib.h>
#include <emscripten/emscripten.h>
#include <emscripten/html5.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
int main()
{
EmscriptenWebGLContextAttributes attr;
emscripten_webgl_init_context_attributes(&attr);
attr.enableExtensionsByDefault = 1;
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_create_context("#canvas", &attr);
emscripten_webgl_make_context_current(ctx);
glClearColor(0.3f,0.3f,0.3f,1);
glClear(GL_COLOR_BUFFER_BIT);
/*
* Not drawing anything, just testing if it compiles and links
*/
glDrawArraysInstanced(GL_TRIANGLES, 0, 0, 0);
glDrawArraysInstancedARB(GL_TRIANGLES, 0, 0, 0);
glDrawArraysInstancedANGLE(GL_TRIANGLES, 0, 0, 0);
return 0;
}
@arielm

arielm commented Nov 19, 2021

Copy link
Copy Markdown
Author

More context here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment