File: glut_glinfo.cpp

package info (click to toggle)
coin3 4.0.3%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 54,428 kB
  • sloc: cpp: 256,086; ansic: 21,309; makefile: 8,661; sh: 3,141; perl: 1,504; lex: 1,372; lisp: 1,247; pascal: 961; xml: 604; yacc: 387; sed: 68
file content (72 lines) | stat: -rw-r--r-- 1,388 bytes parent folder | download | duplicates (10)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
  Tool that reads out GL_VENDOR, GL_VERSION and GL_EXTENSIONS and prints them to stdout.
  We use glut to open a GL context.
*/

#ifdef __APPLE__
#include <GLUT/glut.h>
#include <OpenGL/gl.h>
#else
#include <GL/glut.h>
#include <GL/gl.h>
#endif

#include <cstdio>
#include <cstdlib>

int glutwin;

// Redraw on expose events.
void
expose_cb(void)
{
  const char * version = (const char *)glGetString(GL_VERSION);
  const char * vendor = (const char *)glGetString(GL_VENDOR);
  const char * ext = (const char *)glGetString(GL_EXTENSIONS);

  fprintf(stdout,"Vendor: %s\n", vendor);
  fprintf(stdout,"Version: %s\n", version);
  fprintf(stdout,"Extensions: %s\n", ext);

  // just exit the application immediately
  glutDestroyWindow(glutwin);
}


// ----------------------------------------------------------------------

#ifdef _WIN32

#include <windows.h>
#include <winbase.h>

int
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
        int nCmdShow)
{
#else // UNIX

int
main(int argc, char ** argv)
{

#endif

#ifdef _WIN32
  int argc = 1;
  char * argv[] = { "glut_glinfo.exe", (char *) NULL };
  glutInit(&argc, argv);
#else
  glutInit(&argc, argv);
#endif

  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);

  glutInitWindowSize(512, 400);
  glutwin = glutCreateWindow("GLInfo");
  glutDisplayFunc(expose_cb);

  glutMainLoop();

  return -1;
}