-
Notifications
You must be signed in to change notification settings - Fork 0
/
OpenGL.xs
130 lines (90 loc) · 3 KB
/
OpenGL.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
127
128
129
130
/* Last saved: Sun 06 Sep 2009 02:09:23 PM*/
/* Copyright (c) 1998 Kenneth Albanowski. All rights reserved.
* Copyright (c) 2007 Bob Free. All rights reserved.
* Copyright (c) 2009 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.
*/
/* This ends up being OpenGL.pm */
#define IN_POGL_MAIN_XS
#include <stdio.h>
#include "pgopogl.h"
#ifdef IN_POGL_MAIN_XS
=head2 Miscellaneous
Various BOOT utilities defined in OpenGL.xs
=over
=item PGOPOGL_CALL_BOOT(name)
call the boot code of a module by symbol rather than by name.
in a perl extension which uses several xs files but only one pm, you
need to bootstrap the other xs files in order to get their functions
exported to perl. if the file has MODULE = Foo::Bar, the boot symbol
would be boot_Foo__Bar.
=item void _pgopogl_call_XS (pTHX_ void (*subaddr) (pTHX_ CV *), CV * cv, SV ** mark);
never use this function directly. see C<PGOPOGLL_CALL_BOOT>.
for the curious, this calls a perl sub by function pointer rather than
by name; call_sv requires that the xsub already be registered, but we
need this to call a function which will register xsubs. this is an
evil hack and should not be used outside of the PGOPOGL_CALL_BOOT macro.
it's implemented as a function to avoid code size bloat, and exported
so that extension modules can pull the same trick.
=back
=cut
void
_pgopogl_call_XS (pTHX_ void (*subaddr) (pTHX_ CV *), CV * cv, SV ** mark)
{
dSP;
PUSHMARK (mark);
(*subaddr) (aTHX_ cv);
PUTBACK; /* forget return values */
}
#endif /* End IN_POGL_MAIN_XS */
#ifdef HAVE_GL
#include "gl_util.h"
#endif
#ifdef HAVE_GLX
#include "glx_util.h"
#endif
#ifdef HAVE_GLU
#include "glu_util.h"
#endif
#if defined(HAVE_GLUT) || defined(HAVE_FREEGLUT)
#ifndef GLUT_API_VERSION
#define GLUT_API_VERSION 4
#endif
#include "glut_util.h"
#endif
/* This does not seem to be used */
#if 0
static char *SWIZZLE[4] = {"x","y","z","w"}; */
#endif
/* This does not seem to be used */
#if 0
static int
not_here(s)
char *s;
{
croak("%s not implemented on this architecture", s);
return -1;
}
#endif
MODULE = OpenGL PACKAGE = OpenGL
##################### GLU #########################
############################## GLUT #########################
# /* This is assigned to GLX for now. The glp*() functions should be split out */
BOOT:
PGOPOGL_CALL_BOOT(boot_OpenGL__RPN);
PGOPOGL_CALL_BOOT(boot_OpenGL__Const);
PGOPOGL_CALL_BOOT(boot_OpenGL__GL__Top);
PGOPOGL_CALL_BOOT(boot_OpenGL__GL__AccuGetM);
PGOPOGL_CALL_BOOT(boot_OpenGL__GL__GetPPass);
PGOPOGL_CALL_BOOT(boot_OpenGL__GL__MultProg);
PGOPOGL_CALL_BOOT(boot_OpenGL__GL__PixeVer2);
PGOPOGL_CALL_BOOT(boot_OpenGL__GL__ProgClam);
PGOPOGL_CALL_BOOT(boot_OpenGL__GL__Tex2Draw);
PGOPOGL_CALL_BOOT(boot_OpenGL__GL__Ver3Tex1);
PGOPOGL_CALL_BOOT(boot_OpenGL__GL__VertMulti);
PGOPOGL_CALL_BOOT(boot_OpenGL__GLU);
PGOPOGL_CALL_BOOT(boot_OpenGL__GLUT);
#ifdef __PM__
InitSys();
#endif /* defined __PM__ */