Created
November 19, 2021 10:20
-
-
Save arielm/bcd74cc210c18ccae76c8c17eb597623 to your computer and use it in GitHub Desktop.
Testing OpenGL instancing for emscripten / WebGL1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
More context here