-
Notifications
You must be signed in to change notification settings - Fork 5
/
pogl_gl_top.xs
126 lines (101 loc) · 2.22 KB
/
pogl_gl_top.xs
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
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
119
120
121
122
123
124
125
126
/* Last saved: Mon 27 Feb 2017 01:28:45 PM */
/* Copyright (c) 1998 Kenneth Albanowski. All rights reserved.
* Copyright (c) 2007 Bob Free. All rights reserved.
* Copyright (c) 2009,2017 Chris Marshall. All rights reserved.
* This program is free software; you can redistribute it and/or
* modify it under the same terms as Perl itself.
*/
/* OpenGL GLX bindings */
#define IN_POGL_GLX_XS
#include <stdio.h>
#include "pgopogl.h"
#ifdef HAVE_GL
#include "gl_util.h"
/* Note: this is caching procs once for all contexts */
/* !!! This should instead cache per context */
#if defined(_WIN32) || (defined(__CYGWIN__) && defined(HAVE_W32API))
#define loadProc(proc,name) \
{ \
if (!proc) \
{ \
proc = (void *)wglGetProcAddress(name); \
if (!proc) croak(name " is not supported by this renderer"); \
} \
}
#define testProc(proc,name) ((proc) ? 1 : !!(proc = (void *)wglGetProcAddress(name)))
#else /* not using WGL */
#define loadProc(proc,name)
#define testProc(proc,name) 1
#endif /* not defined _WIN32, __CYGWIN__, and HAVE_W32API */
#endif /* defined HAVE_GL */
MODULE = OpenGL::GLUT::GL::Top PACKAGE = OpenGL::GLUT
#// Test for GL
int
_have_gl()
CODE:
#ifdef HAVE_GL
RETVAL = 1;
#else
RETVAL = 0;
#endif /* defined HAVE_GL */
OUTPUT:
RETVAL
#// Test for GLU
int
_have_glu()
CODE:
#ifdef HAVE_GLU
RETVAL = 1;
#else
RETVAL = 0;
#endif /* defined HAVE_GLU */
OUTPUT:
RETVAL
#// Test for GLUT
int
_have_glut()
CODE:
#if defined(HAVE_GLUT) || defined(HAVE_FREEGLUT)
RETVAL = 1;
#else
RETVAL = 0;
#endif /* defined HAVE_GLUT or HAVE_FREEGLUT */
OUTPUT:
RETVAL
#// Test for FreeGLUT
int
_have_freeglut()
CODE:
#if defined(HAVE_FREEGLUT)
RETVAL = 1;
#else
RETVAL = 0;
#endif /* defined HAVE_FREEGLUT */
OUTPUT:
RETVAL
#// Test for GLX
int
_have_glx()
CODE:
#ifdef HAVE_GLX
RETVAL = 1;
#else
RETVAL = 0;
#endif /* defined HAVE_GLX */
OUTPUT:
RETVAL
#// Test for GLpc
int
_have_glp()
CODE:
#ifdef HAVE_GLpc
RETVAL = 1;
#else
RETVAL = 0;
#endif /* defined HAVE_GLpc */
OUTPUT:
RETVAL
# /* 13000 lines snipped */
##################### GLU #########################
############################## GLUT #########################
# /* This is assigned to GLX for now. The glp*() functions should be split out */