Skip to content

Latest commit

 

History

History
145 lines (115 loc) · 4.27 KB

glcaps.c

File metadata and controls

145 lines (115 loc) · 4.27 KB
 
May 3, 2008
May 3, 2008
1
2
3
4
5
6
#ifdef _WINDOWS
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#endif
#include <stdio.h>
May 3, 2008
May 3, 2008
7
#define GL_GLEXT_LEGACY 1
May 3, 2008
May 3, 2008
8
9
10
11
#include "GL/gl.h"
#include "GL/glext.h"
#include "SDL.h"
May 3, 2008
May 3, 2008
12
13
14
15
#ifndef WINGDIAPI
#define WINGDIAPI
#endif
May 3, 2008
May 3, 2008
16
typedef WINGDIAPI void (APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *params);
May 3, 2008
May 3, 2008
17
18
typedef WINGDIAPI const GLubyte * (APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
May 3, 2008
May 3, 2008
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT
#define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2
#endif
#ifndef GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT
#define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3
#endif
#ifndef GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT
#define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4
#endif
#ifndef GL_MAX_BINDABLE_UNIFORM_SIZE_EXT
#define GL_MAX_BINDABLE_UNIFORM_SIZE_EXT 0x8DED
#endif
May 3, 2008
May 3, 2008
33
34
int main(int argc, char **argv)
{
Feb 21, 2014
Feb 21, 2014
35
int retval = 1;
May 3, 2008
May 3, 2008
36
GLint val = 0;
Jun 29, 2008
Jun 29, 2008
37
const char *str = NULL;
Feb 21, 2014
Feb 21, 2014
38
SDL_Window *sdlwindow = NULL;
May 3, 2008
May 3, 2008
39
Feb 21, 2014
Feb 21, 2014
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
if (SDL_Init(SDL_INIT_VIDEO) == -1)
fprintf(stderr, "SDL_Init() error: %s\n", SDL_GetError());
else if (SDL_GL_LoadLibrary(NULL) == -1)
fprintf(stderr, "SDL_GL_LoadLibrary() error: %s\n", SDL_GetError());
else if ((sdlwindow = SDL_CreateWindow(argv[0], SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_OPENGL)) == NULL)
fprintf(stderr, "SDL_CreateWindow() error: %s\n", SDL_GetError());
if (SDL_GL_CreateContext(sdlwindow) == NULL)
fprintf(stderr, "SDL_GL_CreateContext() error: %s\n", SDL_GetError());
else
retval = 0;
if (retval != 0)
{
SDL_Quit();
return retval;
} // if
May 3, 2008
May 3, 2008
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
PFNGLGETSTRINGPROC pglGetString = (PFNGLGETSTRINGPROC) SDL_GL_GetProcAddress("glGetString");
PFNGLGETINTEGERVPROC pglGetIntegerv = (PFNGLGETINTEGERVPROC) SDL_GL_GetProcAddress("glGetIntegerv");
PFNGLGETPROGRAMIVARBPROC pglGetProgramivARB = (PFNGLGETPROGRAMIVARBPROC) SDL_GL_GetProcAddress("glGetProgramivARB");
printf("Basic strings...\n\n");
#define getval(x) printf(#x ": %s\n", pglGetString(x))
getval(GL_RENDERER);
getval(GL_VERSION);
getval(GL_VENDOR);
#undef getval
printf("\nExtensions...\n\n");
const GLubyte *ext = pglGetString(GL_EXTENSIONS);
while (*ext)
{
fputc((*ext == ' ') ? '\n' : ((int) *ext), stdout);
ext++;
} // while
ext--;
if (*ext != ' ')
printf("\n");
printf("\nARB1 values...\n\n");
if (pglGetProgramivARB == NULL)
printf(" (unsupported.)\n");
else
{
#define getval(x) \
val = -1; \
pglGetProgramivARB(GL_VERTEX_PROGRAM_ARB, x, &val); \
printf(#x ": %d\n", (int) val);
getval(GL_MAX_PROGRAM_INSTRUCTIONS_ARB);
getval(GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB);
getval(GL_MAX_PROGRAM_TEMPORARIES_ARB);
getval(GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB);
getval(GL_MAX_PROGRAM_PARAMETERS_ARB);
getval(GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB);
getval(GL_MAX_PROGRAM_ATTRIBS_ARB);
getval(GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB);
getval(GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB);
getval(GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB);
getval(GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB);
getval(GL_MAX_PROGRAM_ENV_PARAMETERS_ARB);
getval(GL_MAX_PROGRAM_PARAMETERS_ARB);
#undef getval
} // else
printf("\nGLSL values...\n\n");
#define getval(x) \
val = -1; \
pglGetIntegerv(x, &val); \
printf(#x ": %d\n", (int) val);
Jun 29, 2008
Jun 29, 2008
119
120
str = (const char *) pglGetString(GL_SHADING_LANGUAGE_VERSION_ARB);
printf("GL_SHADING_LANGUAGE_VERSION_ARB: %s\n", str);
May 3, 2008
May 3, 2008
121
122
getval(GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB);
getval(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB);
May 3, 2008
May 3, 2008
123
124
125
126
127
128
getval(GL_MAX_VARYING_FLOATS_ARB);
getval(GL_MAX_VERTEX_ATTRIBS_ARB);
getval(GL_MAX_TEXTURE_IMAGE_UNITS_ARB);
getval(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB);
getval(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB);
getval(GL_MAX_TEXTURE_COORDS_ARB);
May 3, 2008
May 3, 2008
129
May 3, 2008
May 3, 2008
130
131
132
133
134
135
136
printf("\nGL_EXT_bindable_uniform values...\n\n");
getval(GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT);
getval(GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT);
getval(GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT);
getval(GL_MAX_BINDABLE_UNIFORM_SIZE_EXT);
May 3, 2008
May 3, 2008
137
138
139
140
141
142
143
#undef getval
SDL_Quit();
printf("\n");
return 0;
}