File: glversion.c

package info (click to toggle)
libopengl-perl 0.7000%2Bdfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,312 kB
  • sloc: perl: 10,178; ansic: 8,576; makefile: 111
file content (57 lines) | stat: -rwxr-xr-x 1,378 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <stdio.h>

#if defined(HAVE_FREEGLUT)

#ifdef WIN32
#include "../include/GL/freeglut.h"
#else
#include <GL/freeglut.h>
#endif

#else

#ifdef __APPLE__
/* NB: not ideal -- this assumes that we always build with AGL interface on Mac OS X
 * Ideally, the flag HAVE_AGL_GLUT should be set appropriately by Makefile.PL when building glversion
 * and used to check here, but this will require substantial changes to the get_extensions() there
 */
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif

#endif

#define PROGRAM "glversion"

int main(int argc, char **argv)
{
  char *version = NULL;
  char *vendor = NULL;
  char *renderer = NULL;
  char *extensions = NULL;
  GLuint idWindow = 0;
  int	freeglutVersion;

  glutInit(&argc, argv);
  glutInitWindowSize(1,1);
  glutInitDisplayMode(GLUT_RGBA);
  idWindow = glutCreateWindow(PROGRAM);
  glutHideWindow();

  version =     (char*)glGetString(GL_VERSION);
  vendor =      (char*)glGetString(GL_VENDOR);
  renderer =    (char*)glGetString(GL_RENDERER);
  extensions =  (char*)glGetString(GL_EXTENSIONS);

  freeglutVersion = glutGet(0x01FC);
  if(freeglutVersion != -1) {
    printf("FREEGLUT=%d\n", freeglutVersion);
  }
  printf("GLUT=%d\n", GLUT_API_VERSION);

  printf("VERSION=%s\nVENDOR=%s\nRENDERER=%s\nEXTENSIONS=%s\n", version, vendor, renderer, extensions);

  glutDestroyWindow(idWindow);
  return(0);
}