2 * Copyright (C) 2009-2010 Andy Spencer <andy753421@gmail.com>
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #define COUNT(arr) (sizeof(arr)/sizeof(arr[0]))
26 int main(int argc, char **argv)
28 glutInit(&argc, argv);
29 glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
30 glutInitWindowSize(250,250);
31 glutInitWindowPosition(100,100);
32 glutCreateWindow("Hello World!");
37 glGetIntegerv(GL_MAX_TEXTURE_SIZE, &size);
38 printf("\nGL_MAX_TEXTURE_SIZE = %d\n", size);
42 const char *exts[] = {
43 "GL_ARB_texture_rectangle",
44 "GL_ARB_texture_non_power_of_two",
45 "GL_ARB_does_not_exist",
47 printf("\nChecking some extensions...\n");
48 const char *avail = (char*)glGetString(GL_EXTENSIONS);
49 for (int i = 0; i < COUNT(exts); i++)
50 printf("\t%s: %s\n", exts[i],
51 strstr(avail,exts[i]) ? "OK" : "Error");
54 /* Test sample image */
66 printf("\nTrying some sizes...\n");
67 for (int i = 0; i < COUNT(sizes); i++) {
68 GLint width = sizes[i][0];
69 GLint height = sizes[i][1];
70 printf("\t%dx%d: ", width, height);
71 glTexImage2D(GL_PROXY_TEXTURE_2D, 0, 4, width, height, 0,
72 GL_RGBA, GL_UNSIGNED_BYTE, NULL);
73 glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width);
74 glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &height);
75 printf("%s\n", width && height ? "OK" : "Error");
80 printf("\nPress any key to exit..\n");