Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/test/browser/glew.c
7085 views
1
/*
2
* Copyright 2014 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 <GL/glew.h>
9
#include <stdio.h>
10
#include <assert.h>
11
#include <string.h>
12
13
/* for context creation */
14
#include <SDL/SDL.h>
15
16
int main() {
17
assert(SDL_Init(SDL_INIT_VIDEO) == 0);
18
assert(SDL_SetVideoMode(640, 480, 16, SDL_OPENGL) != NULL);
19
20
assert(glewInit() == GLEW_OK);
21
assert(glewGetString(0) == NULL);
22
assert(!strcmp((const char*)glewGetString(1), "1.10.0"));
23
assert(!strcmp((const char*)glewGetString(2), "1"));
24
assert(!strcmp((const char*)glewGetString(3), "10"));
25
assert(!strcmp((const char*)glewGetString(4), "0"));
26
27
for (int i = 0; i < 8; ++i) {
28
assert(glewGetErrorString(i) != NULL);
29
}
30
31
assert(glewGetExtension("EXT_unexistant") == 0);
32
assert(glewIsSupported("EXT_unexistant EXT_foobar") == 0);
33
34
/* we can't be sure about which extension exists, so lets do test on
35
* some of the common ones */
36
if (GLEW_EXT_texture_filter_anisotropic) {
37
assert(glewGetExtension("EXT_texture_filter_anisotropic") == 1);
38
assert(glewGetExtension("GL_EXT_texture_filter_anisotropic") == 1);
39
}
40
41
if (GLEW_EXT_framebuffer_object) {
42
assert(glewGetExtension("EXT_framebuffer_object") == 1);
43
assert(glewGetExtension("GL_EXT_framebuffer_object") == 1);
44
}
45
46
if (GLEW_EXT_texture_filter_anisotropic &&
47
GLEW_EXT_framebuffer_object) {
48
assert(glewIsSupported("EXT_texture_filter_anisotropic EXT_framebuffer_object") == 1);
49
assert(glewIsSupported("GL_EXT_texture_filter_anisotropic GL_EXT_framebuffer_object") == 1);
50
}
51
52
#ifdef REPORT_RESULT
53
REPORT_RESULT(1);
54
#endif
55
return 0;
56
}
57
58