Start work on WebGL bindings
[wasm.git] / test.cpp
index da73b69c05fe49a1f81455ed5ba2360eb15bdf94..d59323af877cb9a5b084d770b824e96d3a05d51a 100644 (file)
--- a/test.cpp
+++ b/test.cpp
@@ -1,6 +1,18 @@
-#include <vector>
+#include <GLES2/gl2.h>
+#include <string>
+
+const char* vertShaderSrc = R"(
+       attribute vec4 vertPos;
+       void main() {
+               gl_Position = vertPos;
+       }
+)";
+
 extern "C" int foo() {
-       std::vector<int> *xs = new std::vector<int>();
-       xs->push_back(42);
-       return (*xs)[0];
+       GLuint vertShader = glCreateShader(GL_VERTEX_SHADER);
+       const char* sources[1] = { vertShaderSrc };
+       const GLint lengths[1] = { (GLint)strlen(vertShaderSrc) };
+       glShaderSource(vertShader, 1, sources, lengths);
+       glCompileShader(vertShader);
+       return 0;
 }