1 // Copyright 2012 The Emscripten Authors.  All rights reserved.
2 // Emscripten is available under two separate licenses, the MIT license and the
3 // University of Illinois/NCSA Open Source License.  Both these licenses can be
4 // found in the LICENSE file.
5 
6 #define GL_GLEXT_PROTOTYPES
7 #define EGL_EGLEXT_PROTOTYPES
8 
9 #include <math.h>
10 #include <stdlib.h>
11 #include <stdio.h>
12 #include <string.h>
13 #include <sys/time.h>
14 #include <unistd.h>
15 #ifdef __APPLE__
16 #include <OpenGL/gl.h>
17 #include <Glut/glut.h>
18 #else
19 #include <GL/gl.h>
20 #include <GL/glut.h>
21 #endif
22 
23 #include <assert.h>
24 #include <emscripten.h>
25 
main(int argc,char * argv[])26 int main(int argc, char *argv[])
27 {
28    /* Initialize the window */
29    glutInit(&argc, argv);
30    glutInitWindowSize(300, 300);
31    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
32 
33    glutCreateWindow("es2gears");
34 
35    GLint shaderCompiler;
36    glGetIntegerv(GL_SHADER_COMPILER, &shaderCompiler);
37 
38    GLint numShaderBinaryFormats;
39    glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &numShaderBinaryFormats);
40 
41    printf("%d,%d\n", shaderCompiler, numShaderBinaryFormats);
42 
43    if (!shaderCompiler && numShaderBinaryFormats == 0) {
44       printf("In current environment, the GLES2 implementation IS NOT standard conforming! "
45            "GL_SHADER_COMPILER == GL_FALSE and GL_NUM_SHADER_BINARY_FORMATS == 0! "
46            "In GLES2 spec, either compiling shaders or binary shaders must be supported! (Section 2.10 - Vertex Shaders)\n");
47       REPORT_RESULT(0);
48    } else {
49       assert(numShaderBinaryFormats == 0);
50       REPORT_RESULT(1);
51    }
52    return 0;
53 }
54