~ubuntu-branches/ubuntu/saucy/emscripten/saucy-proposed

« back to all changes in this revision

Viewing changes to tests/cubegeom_pre.c

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-02 13:11:51 UTC
  • Revision ID: package-import@ubuntu.com-20130502131151-q8dvteqr1ef2x7xz
Tags: upstream-1.4.1~20130504~adb56cb
ImportĀ upstreamĀ versionĀ 1.4.1~20130504~adb56cb

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
THIS WORK, INCLUDING THE SOURCE CODE, DOCUMENTATION
 
3
AND RELATED MEDIA AND DATA, IS PLACED INTO THE PUBLIC DOMAIN.
 
4
 
 
5
THE ORIGINAL AUTHOR IS KYLE FOLEY.
 
6
 
 
7
THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY
 
8
OF ANY KIND, NOT EVEN THE IMPLIED WARRANTY OF
 
9
MERCHANTABILITY. THE AUTHOR OF THIS SOFTWARE,
 
10
ASSUMES _NO_ RESPONSIBILITY FOR ANY CONSEQUENCE
 
11
RESULTING FROM THE USE, MODIFICATION, OR
 
12
REDISTRIBUTION OF THIS SOFTWARE.
 
13
*/
 
14
 
 
15
#if !EMSCRIPTEN
 
16
#define USE_GLEW 1
 
17
#endif
 
18
 
 
19
#if USE_GLEW
 
20
#include "GL/glew.h"
 
21
#endif
 
22
 
 
23
#include "SDL/SDL.h"
 
24
#if !USE_GLEW
 
25
#include "SDL/SDL_opengl.h"
 
26
#endif
 
27
 
 
28
#include <stdio.h>
 
29
#include <string.h>
 
30
#include <assert.h>
 
31
 
 
32
void verify() {
 
33
  int width = 640, height = 480;
 
34
  unsigned char *data = (unsigned char*)malloc(width*height*4);
 
35
  glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, data);
 
36
  int sum = 0;
 
37
  for (int x = 0; x < width*height*4; x++) {
 
38
    if (x % 4 != 3) sum += x * data[x];
 
39
  }
 
40
#if EMSCRIPTEN
 
41
  int result = sum;
 
42
  REPORT_RESULT();
 
43
#endif
 
44
}
 
45
 
 
46
int main(int argc, char *argv[])
 
47
{
 
48
    SDL_Surface *screen;
 
49
    if ( SDL_Init(SDL_INIT_VIDEO) != 0 ) {
 
50
        printf("Unable to initialize SDL: %s\n", SDL_GetError());
 
51
        return 1;
 
52
    }
 
53
 
 
54
    SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
 
55
    screen = SDL_SetVideoMode( 640, 480, 24, SDL_OPENGL );
 
56
    if ( !screen ) {
 
57
        printf("Unable to set video mode: %s\n", SDL_GetError());
 
58
        return 1;
 
59
    }
 
60
    
 
61
    glClearColor( 0, 0, 0, 0 );
 
62
    glClear( GL_COLOR_BUFFER_BIT );
 
63
 
 
64
    // Create a texture
 
65
 
 
66
    GLuint texture;
 
67
    glGenTextures( 1, &texture );
 
68
    glBindTexture( GL_TEXTURE_2D, texture );
 
69
    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
 
70
    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
 
71
    GLubyte textureData[16*16*4];
 
72
    for (int x = 0; x < 16; x++) {
 
73
      for (int y = 0; y < 16; y++) {
 
74
        *((int*)&textureData[(x*16 + y) * 4]) = x*16 + ((y*16) << 8);
 
75
      }
 
76
    }
 
77
    glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, 
 
78
                  GL_RGBA, GL_UNSIGNED_BYTE, textureData );
 
79
 
 
80
    // Create a second texture
 
81
 
 
82
    GLuint texture2;
 
83
    glGenTextures( 1, &texture2 );
 
84
    glBindTexture( GL_TEXTURE_2D, texture2 );
 
85
    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
 
86
    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
 
87
    GLubyte texture2Data[] = { 0xff,    0,    0, 0xff,
 
88
                                  0, 0xff,    0, 0xaa,
 
89
                                  0,    0, 0xff, 0x55,
 
90
                               0x80, 0x90, 0x70,    0 };
 
91
    glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0,
 
92
                  GL_RGBA, GL_UNSIGNED_BYTE, texture2Data );
 
93
    
 
94
    // BEGIN
 
95
 
 
96
#if USE_GLEW
 
97
    glewInit();
 
98
#endif
 
99
 
 
100
    glMatrixMode(GL_PROJECTION);
 
101
    glLoadIdentity();
 
102
    // original: glFrustum(-0.6435469817188064, 0.6435469817188064 ,-0.48266022190470925, 0.48266022190470925 ,0.5400000214576721, 2048);
 
103
    //glFrustum(-0.6435469817188064, 0.1435469817188064 ,-0.48266022190470925, 0.88266022190470925 ,0.5400000214576721, 2048);
 
104
    GLfloat pm[] = { 1.372136116027832, 0, 0, 0, 0, 0.7910231351852417, 0, 0, -0.6352481842041016, 0.29297152161598206, -1.0005275011062622, -1, 0, 0, -1.080284833908081, 0 };
 
105
    glLoadMatrixf(pm);
 
106
 
 
107
    glMatrixMode(GL_MODELVIEW);
 
108
    GLfloat matrixData[] = { -1, 0, 0, 0,
 
109
                              0, 0,-1, 0,
 
110
                              0, 1, 0, 0,
 
111
                              0, 0, 0, 1 };
 
112
    glLoadMatrixf(matrixData);
 
113
 
 
114
    glActiveTexture(GL_TEXTURE0);
 
115
 
 
116
    GLuint arrayBuffer, elementBuffer;
 
117
    glGenBuffers(1, &arrayBuffer);
 
118
    glGenBuffers(1, &elementBuffer);
 
119
 
 
120
    GLubyte arrayData[] = {
 
121
/*
 
122
[0, 0,   0, 67] ==>  128 float
 
123
[0, 0, 128, 67] ==>  256 float
 
124
[0, 0,   0, 68] ==>  512 float
 
125
[0, 0, 128, 68] ==> 1024 float
 
126
 
 
127
[vertex x        ] [vertex y         ] [vertex z         ] [nr]                [texture u        ] [texture v        ] [lm u   ] [lm v   ] [color r,g,b,a    ] */
 
128
  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128, //  0
 
129
  0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,  67,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128, //  1
 
130
  0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,  67,   0,   0,   0,  67,   0,   0,   0,   0, 128, 128, 128, 128, //  2
 
131
  0,   0,   0,   0,   0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  67,   0,   0,   0,   0, 128, 128, 128, 128, //  3
 
132
  0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,  67,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128, //  4
 
133
  0,   0, 128,  68,   0,   0,   0,   0,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0, 128,  67,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128, //  5
 
134
  0,   0, 128,  68,   0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0, 128,  67,   0,   0,   0,  67,   0,   0,   0,   0, 128, 128, 128, 128, //  6
 
135
  0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,  67,   0,   0,   0,  67,   0,   0,   0,   0, 128, 128, 128, 128, //  7
 
136
  0,   0,   0,   0,   0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  67,   0,   0,   0,   0, 128, 128, 128, 128, //  8
 
137
  0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,  67,   0,   0,   0,  67,   0,   0,   0,   0, 128, 128, 128, 128, //  9
 
138
  0,   0,   0,  68,   0,   0, 128,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,  67,   0,   0, 128,  67,   0,   0,   0,   0, 128, 128, 128, 128, // 10
 
139
  0,   0,   0,   0,   0,   0, 128,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128,  67,   0,   0,   0,   0, 128, 128, 128, 128, // 11
 
140
  0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,  67,   0,   0,   0,  67,   0,   0,   0,   0, 128, 128, 128, 128, // 12
 
141
  0,   0, 128,  68,   0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0, 128,  67,   0,   0,   0,  67,   0,   0,   0,   0, 128, 128, 128, 128, // 13
 
142
  0,   0, 128,  68,   0,   0, 128,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0, 128,  67,   0,   0, 128,  67,   0,   0,   0,   0, 128, 128, 128, 128, // 14
 
143
  0,   0,   0,  68,   0,   0, 128,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,  67,   0,   0, 128,  67,   0,   0,   0,   0, 128, 128, 128, 128, // 15
 
144
 
 
145
  0,   0,   0,  68,   0,   0,   0,  68,   0,   0, 128,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
146
  0,   0,   0,  68,   0,   0,   0,   0,   0,   0, 128,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
147
  0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
148
  0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
149
  0,   0,   0,   0,   0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
150
  0,   0,   0,   0,   0,   0,   0,  68,   0,   0, 128,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
151
  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
152
  0,   0,   0,  68,   0,   0,   0,  68,   0,   0, 128,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
153
  0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
154
  0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
155
  0,   0,   0,  68,   0,   0,   0,   0,   0,   0, 128,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
156
  0,   0, 128,  68,   0,   0,   0,  68,   0,   0, 128,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
157
  0,   0, 128,  68,   0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
158
  0,   0, 128,  68,   0,   0,   0,   0,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
159
  0,   0,   0,  68,   0,   0, 128,  68,   0,   0, 128,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
160
  0,   0,   0,  68,   0,   0,   0,  68,   0,   0, 128,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
161
  0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
162
  0,   0,   0,  68,   0,   0, 128,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
163
  0,   0,   0,   0,   0,   0,   0,  68,   0,   0, 128,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
164
  0,   0,   0,   0,   0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
165
  0,   0,   0,   0,   0,   0, 128,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
166
  0,   0,   0,  68,   0,   0, 128,  68,   0,   0, 128,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
167
  0,   0,   0,  68,   0,   0, 128,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
168
  0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
169
  0,   0,   0,  68,   0,   0,   0,  68,   0,   0, 128,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
170
  0,   0, 128,  68,   0,   0,   0,  68,   0,   0, 128,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
171
  0,   0, 128,  68,   0,   0,   0,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128,
 
172
  0,   0, 128,  68,   0,   0, 128,  68,   0,   0,   0,  68,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 128, 128, 128, 128
 
173
    };
 
174
    assert(sizeof(arrayData) == 1408);
 
175
    glBindBuffer(GL_ARRAY_BUFFER, arrayBuffer);
 
176
    glBufferData(GL_ARRAY_BUFFER, sizeof(arrayData), arrayData, GL_STATIC_DRAW);
 
177
    glBindBuffer(GL_ARRAY_BUFFER, 0);
 
178
 
 
179
    GLushort elementData[] = { 1, 2, 0, 2, 3, 0, 5, 6, 4, 6, 7, 4, 9, 10, 8, 10, 11, 8, 13, 14, 12, 14, 15, 12 };
 
180
    assert(sizeof(elementData) == 48);
 
181
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementBuffer);
 
182
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(elementData), elementData, GL_STATIC_DRAW);
 
183
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
 
184
 
 
185
    glBindBuffer(GL_ARRAY_BUFFER, arrayBuffer);
 
186
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementBuffer);
 
187
 
 
188
    glBindTexture(GL_TEXTURE_2D, texture); // diffuse?
 
189
    glActiveTexture(GL_TEXTURE0);
 
190
    glActiveTexture(GL_TEXTURE1);
 
191
    glBindTexture(GL_TEXTURE_2D, texture2); // lightmap?
 
192
    glActiveTexture(GL_TEXTURE0);
 
193
 
 
194
    GLint ok;
 
195
 
 
196
    const char *vertexShader = "attribute vec4 a_position;\n"
 
197
                               "attribute vec4 a_texCoord0;\n"
 
198
                               "uniform mat4 u_modelView;\n"
 
199
                               "uniform mat4 u_projection;\n"
 
200
                               "varying vec4 v_texCoord0;\n"
 
201
                               "void main(void)\n"
 
202
                               "{\n"
 
203
                               "    gl_Position = (u_projection * u_modelView * a_position) + vec4(200, 0, 0, 0);\n"
 
204
                               "    v_texCoord0.xy = a_texCoord0.xy/20.0;\n" // added /20 here
 
205
                               "}\n";
 
206
    const char *fragmentShader = "uniform sampler2D diffusemap;\n"
 
207
                                 "varying vec4 v_texCoord0;\n"
 
208
                                 "void main(void)\n"
 
209
                                 "{\n"
 
210
                                 "    vec4 diffuse = texture2D(diffusemap, v_texCoord0.xy);\n"
 
211
                                 "    gl_FragColor = diffuse;\n"
 
212
                                 "}\n";
 
213
 
 
214
    GLuint vs = glCreateShader(GL_VERTEX_SHADER);
 
215
    glShaderSource(vs, 1, &vertexShader, NULL);
 
216
    glCompileShader(vs);
 
217
    glGetShaderiv(vs, GL_COMPILE_STATUS, &ok);
 
218
    if (!ok) {
 
219
      printf("Shader compilation error with vertex\n");
 
220
      GLint infoLen = 0;
 
221
      glGetShaderiv (vs, GL_INFO_LOG_LENGTH, &infoLen);
 
222
      if (infoLen > 1)
 
223
      {
 
224
         char* infoLog = (char *)malloc(sizeof(char) * infoLen+1);
 
225
         glGetShaderInfoLog(vs, infoLen, NULL, infoLog);
 
226
         printf("Error compiling shader:\n%s\n", infoLog);            
 
227
      }
 
228
    }
 
229
 
 
230
    GLuint fs = glCreateShader(GL_FRAGMENT_SHADER);
 
231
    glShaderSource(fs, 1, &fragmentShader, NULL);
 
232
    glCompileShader(fs);
 
233
    glGetShaderiv(fs, GL_COMPILE_STATUS, &ok);
 
234
    if (!ok) {
 
235
      printf("Shader compilation error with fragment\n");
 
236
      GLint infoLen = 0;
 
237
      glGetShaderiv (vs, GL_INFO_LOG_LENGTH, &infoLen);
 
238
      if (infoLen > 1)
 
239
      {
 
240
         char* infoLog = (char *)malloc(sizeof(char) * infoLen+1);
 
241
         glGetShaderInfoLog(vs, infoLen, NULL, infoLog);
 
242
         printf("Error compiling shader:\n%s\n", infoLog);            
 
243
      }
 
244
    }
 
245
 
 
246
    GLuint program = glCreateProgram();
 
247
 
 
248
    glAttachShader(program, vs);
 
249
    glAttachShader(program, fs);
 
250
    glLinkProgram(program);
 
251
    glGetProgramiv(program, GL_LINK_STATUS, &ok);
 
252
    assert(ok);
 
253
 
 
254
    glUseProgram(program);
 
255
 
 
256
    GLint diffusemapLocation = glGetUniformLocation(program, "diffusemap");
 
257
    assert(diffusemapLocation >= 0);
 
258
    glUniform1i(diffusemapLocation, 0);
 
259
 
 
260
    {
 
261
      GLfloat data[16];
 
262
      glGetFloatv(GL_MODELVIEW_MATRIX, data);
 
263
      printf("Modelview: ");
 
264
      for (int i = 0; i < 16; i++) printf("%.3f, ", data[i]);
 
265
      printf("\n");
 
266
      GLint modelViewLocation = glGetUniformLocation(program, "u_modelView");
 
267
      assert(modelViewLocation >= 0);
 
268
      glUniformMatrix4fv(modelViewLocation, 1, GL_FALSE, data);
 
269
    }
 
270
    {
 
271
      GLfloat data[16];
 
272
      glGetFloatv(GL_PROJECTION_MATRIX, data);
 
273
      printf("Projection: ");
 
274
      for (int i = 0; i < 16; i++) printf("%.3f, ", data[i]);
 
275
      printf("\n");
 
276
      GLint projectionLocation = glGetUniformLocation(program, "u_projection");
 
277
      assert(projectionLocation >= 0);
 
278
      glUniformMatrix4fv(projectionLocation, 1, GL_FALSE, data);
 
279
    }
 
280
 
 
281
    glBindAttribLocation(program, 0, "a_position");
 
282
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 32, (void*)0);
 
283
    glEnableVertexAttribArray(0);
 
284
 
 
285
    glBindAttribLocation(program, 1, "a_texCoord0");
 
286
    glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 32, (void*)16);
 
287
    glEnableVertexAttribArray(1);
 
288
 
 
289
    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, (void*)12);
 
290
    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, (void*) 0);
 
291
    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, (void*)24);
 
292
    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, (void*)36);
 
293
 
 
294
    // END
 
295
 
 
296
    SDL_GL_SwapBuffers();
 
297
 
 
298
    verify();
 
299
    
 
300
#if !EMSCRIPTEN
 
301
    SDL_Delay(1500);
 
302
#endif
 
303
 
 
304
    SDL_Quit();
 
305
    
 
306
    return 0;
 
307
}