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_does_not_exist",
46 printf("\nChecking some extensions...\n");
47 const char *avail = (char*)glGetString(GL_EXTENSIONS);
48 for (int i = 0; i < COUNT(exts); i++)
49 printf("\t%s: %s\n", exts[i],
50 strstr(avail,exts[i]) ? "OK" : "Error");
53 /* Test sample image */
60 printf("\nTrying some sizes...\n");
61 for (int i = 0; i < COUNT(sizes); i++) {
62 GLint width = sizes[i][0];
63 GLint height = sizes[i][1];
64 printf("\t%dx%d: ", width, height);
65 glTexImage2D(GL_PROXY_TEXTURE_2D, 0, 4, width, height, 0,
66 GL_RGBA, GL_UNSIGNED_BYTE, NULL);
67 glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width);
68 glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &height);
69 printf("%s\n", width && height ? "OK" : "Error");
74 printf("\nPress any key to exit..\n");