Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/test/browser/gl_error.c
7085 views
1
/*
2
* Copyright 2017 The Emscripten Authors. All rights reserved.
3
* Emscripten is available under two separate licenses, the MIT license and the
4
* University of Illinois/NCSA Open Source License. Both these licenses can be
5
* found in the LICENSE file.
6
*/
7
8
#include <assert.h>
9
#include <GL/gl.h>
10
#include <stdio.h>
11
#include <string.h>
12
#include "SDL/SDL.h"
13
14
int main() {
15
SDL_Surface *screen;
16
17
assert(SDL_Init(SDL_INIT_VIDEO) == 0);
18
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
19
screen = SDL_SetVideoMode( 256, 256, 16, SDL_OPENGL );
20
assert(screen);
21
22
// glGetError again should return 0 initially
23
assert(glGetError() == 0);
24
25
// pop from empty stack, causing an underflow error
26
glPopMatrix();
27
GLenum err = glGetError();
28
printf("glGetError -> %d\n", err);
29
assert(err == GL_STACK_UNDERFLOW);
30
31
// Calling glGetError again should report no error.
32
assert(glGetError() == 0);
33
34
return 0;
35
}
36
37