Move Surface.xs to src/Core/objects/
[sdlgit/SDL_perl.git] / src / OpenGL.xs
CommitLineData
bfd90409 1//
2// OpenGL.xs
3//
4// Copyright (C) 2005 David J. Goehrig <dgoehrig@cpan.org>
5//
6// ------------------------------------------------------------------------------
7//
8// This library is free software; you can redistribute it and/or
9// modify it under the terms of the GNU Lesser General Public
10// License as published by the Free Software Foundation; either
11// version 2.1 of the License, or (at your option) any later version.
12//
13// This library is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16// Lesser General Public License for more details.
17//
18// You should have received a copy of the GNU Lesser General Public
19// License along with this library; if not, write to the Free Software
20// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21//
22// ------------------------------------------------------------------------------
23//
24// Please feel free to send questions, suggestions or improvements to:
25//
26// David J. Goehrig
27// dgoehrig@cpan.org
28//
29
30#include "EXTERN.h"
31#include "perl.h"
32#include "XSUB.h"
33
34#ifndef aTHX_
35#define aTHX_
36#endif
37
38#include <SDL.h>
39
3a32e86d 40#ifdef PERL_DARWIN
41#include <gl.h>
42#include <glu.h>
43#else
85fcc9ee 44#include <GL/gl.h>
2a668066 45
46#if defined(__WIN32__) && defined(__MINGW32__)
47/*
48this is a sort of dirty hack - MS Windows supports just OpenGL 1.1 and all 1.2+
49related stuff was moved from GL/gl.h to GL/glext.h; however this separation
50was done not properly and even if we are OK with OpenGL 1.1 there are some
51constants missing in GL/gl.h thus we need also GL/glext.h
52*/
53#include <GL/glext.h>
54#undef GL_VERSION_1_3
55#undef GL_VERSION_1_2
56#endif
57
85fcc9ee 58#include <GL/glu.h>
3a32e86d 59#endif
60
bfd90409 61
62#ifdef USE_THREADS
63#define HAVE_TLS_CONTEXT
64#endif
65
66#ifndef GL_ALL_CLIENT_ATTRIB_BITS
67#define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFF
68#endif /* GL_ALL_CLIENT_BITS */
69
24379be6 70#define GL_HAS_NURBS
71
2a668066 72#include "../../src/defines.h"
bfd90409 73
74SV* sdl_perl_nurbs_error_hook;
75void
76sdl_perl_nurbs_error_callback ( GLenum errorCode )
77{
78 ENTER_TLS_CONTEXT
79 dSP;
80
81 ENTER;
82 SAVETMPS;
83 PUSHMARK(SP);
84 XPUSHs(sv_2mortal(newSViv(errorCode)));
85 PUTBACK;
86
87 call_sv(sdl_perl_nurbs_error_hook,G_VOID);
88
89 FREETMPS;
90 LEAVE;
91 LEAVE_TLS_CONTEXT
92}
93
94void
95sdl_perl_nurbs_being_callback ( GLenum type, void *cb )
96{
97 SV *cmd;
98 ENTER_TLS_CONTEXT
99 dSP;
100
101 cmd = (SV*)cb;
102
103 ENTER;
104 SAVETMPS;
105 PUSHMARK(SP);
106 XPUSHs(sv_2mortal(newSViv(type)));
107 PUTBACK;
108
109 call_sv(cmd,G_VOID);
110
111 FREETMPS;
112 LEAVE;
113 LEAVE_TLS_CONTEXT
114}
115
116void
117sdl_perl_nurbs_multi_callback ( GLfloat *vec, void *cb )
118{
119 SV *cmd;
120 ENTER_TLS_CONTEXT
121 dSP;
122
123 cmd = (SV*)cb;
124
125 ENTER;
126 SAVETMPS;
127 PUSHMARK(SP);
128 XPUSHs(sv_2mortal(newSViv(PTR2IV(vec))));
129 PUTBACK;
130
131 call_sv(cmd,G_VOID);
132
133 FREETMPS;
134 LEAVE;
135 LEAVE_TLS_CONTEXT
136}
137
138void
139sdl_perl_nurbs_end_callback ( void *cb )
140{
141 SV *cmd;
142 ENTER_TLS_CONTEXT
143
144 cmd = (SV*)cb;
145
146 ENTER;
147 SAVETMPS;
148
149 call_sv(cmd,G_VOID);
150
151 FREETMPS;
152 LEAVE;
153 LEAVE_TLS_CONTEXT
154}
155
156void
157sdl_perl_tess_end_callback ( void *cb )
158{
159 SV *cmd;
160 ENTER_TLS_CONTEXT
161 dSP;
162
163 cmd = (SV*)cb;
164
165 ENTER;
166 SAVETMPS;
167 PUSHMARK(SP);
168 XPUSHs(sv_2mortal(newSViv(GLU_TESS_BEGIN)));
169 PUTBACK;
170
171 call_sv(cmd,G_VOID);
172
173 FREETMPS;
174 LEAVE;
175 LEAVE_TLS_CONTEXT
176}
177
178void
179sdl_perl_tess_begin_callback ( GLenum type, void *cb )
180{
181 SV *cmd;
182 ENTER_TLS_CONTEXT
183 dSP;
184
185 cmd = (SV*)cb;
186
187 ENTER;
188 SAVETMPS;
189 PUSHMARK(SP);
190 XPUSHs(sv_2mortal(newSViv(GLU_TESS_BEGIN)));
191 XPUSHs(sv_2mortal(newSViv(type)));
192 PUTBACK;
193
194 call_sv(cmd,G_VOID);
195
196 FREETMPS;
197 LEAVE;
198 LEAVE_TLS_CONTEXT
199}
200
201void
202sdl_perl_tess_error_callback ( GLenum type, void *cb )
203{
204 SV *cmd;
205 ENTER_TLS_CONTEXT
206 dSP;
207
208 cmd = (SV*)cb;
209
210 ENTER;
211 SAVETMPS;
212 PUSHMARK(SP);
213 XPUSHs(sv_2mortal(newSViv(GLU_TESS_ERROR)));
214 XPUSHs(sv_2mortal(newSViv(type)));
215 PUTBACK;
216
217 call_sv(cmd,G_VOID);
218
219 FREETMPS;
220 LEAVE;
221 LEAVE_TLS_CONTEXT
222}
223
224void
225sdl_perl_tess_edge_flag_callback ( GLenum flag, void *cb )
226{
227 SV *cmd;
228 ENTER_TLS_CONTEXT
229 dSP;
230
231 cmd = (SV*)cb;
232
233 ENTER;
234 SAVETMPS;
235 PUSHMARK(SP);
236 XPUSHs(sv_2mortal(newSViv(GLU_TESS_EDGE_FLAG)));
237 XPUSHs(sv_2mortal(newSViv(flag)));
238 PUTBACK;
239
240 call_sv(cmd,G_VOID);
241
242 FREETMPS;
243 LEAVE;
244 LEAVE_TLS_CONTEXT
245}
246
247void
248sdl_perl_tess_vertex_callback ( double *vd, void *cb )
249{
250 SV *cmd;
251 ENTER_TLS_CONTEXT
252 dSP;
253
254 cmd = (SV*)cb;
255
256 ENTER;
257 SAVETMPS;
258 PUSHMARK(SP);
259 XPUSHs(sv_2mortal(newSViv(GLU_TESS_VERTEX)));
260 XPUSHs(sv_2mortal(newSVnv(vd[0])));
261 XPUSHs(sv_2mortal(newSVnv(vd[1])));
262 XPUSHs(sv_2mortal(newSVnv(vd[2])));
263 XPUSHs(sv_2mortal(newSVnv(vd[3])));
264 XPUSHs(sv_2mortal(newSVnv(vd[4])));
265 XPUSHs(sv_2mortal(newSVnv(vd[5])));
266 PUTBACK;
267
268 call_sv(cmd,G_VOID);
269
270 FREETMPS;
271 LEAVE;
272 LEAVE_TLS_CONTEXT
273}
274
275void
276sdl_perl_tess_combine_callback ( GLdouble coords[3], double *vd[4], GLfloat weight[4],
277 GLdouble **out, void *cb )
278{
279 SV *cmd;
280 double *data;
281 int width;
282 ENTER_TLS_CONTEXT
283 dSP;
284
285 cmd = (SV*)cb;
286
287 ENTER;
288 SAVETMPS;
289 PUSHMARK(SP);
290 XPUSHs(sv_2mortal(newSViv(GLU_TESS_COMBINE)));
291 XPUSHs(sv_2mortal(newSVpvn((char*)coords,sizeof(GLdouble)*3)));
292 XPUSHs(sv_2mortal(newSVpvn((char*)vd,sizeof(GLdouble*)*4)));
293 XPUSHs(sv_2mortal(newSVpvn((char*)weight,sizeof(GLfloat)*4)));
294 PUTBACK;
295
296 if ( 1 != call_sv(cmd,G_SCALAR) ) {
297 Perl_croak(aTHX_ "sdl_perl_tess_combine_callback failed");
298 }
299
300 data = (double*)POPp;
301 width = (int)POPi;
302 *out = (double*)malloc(sizeof(double)*width);
303 memcpy(*out,data,sizeof(double)*width);
304
305 FREETMPS;
306 LEAVE;
307 LEAVE_TLS_CONTEXT
308}
309
310MODULE = SDL::OpenGL PACKAGE = SDL::OpenGL
311PROTOTYPES : DISABLE
312
313#ifdef HAVE_GL
314
315void
316glClearColor ( r, g, b, a)
317 double r
318 double g
319 double b
320 double a
321 CODE:
322 glClearColor((GLfloat)r,(GLfloat)g,(GLfloat)b,(GLfloat)a);
323
324void
325glClearIndex ( index )
326 double index
327 CODE:
328 glClearIndex(index);
329
330void
331glClearDepth ( depth )
332 double depth
333 CODE:
334 glClearDepth(depth);
335
336void
337glClearStencil ( s )
338 int s
339 CODE:
340 glClearStencil(s);
341
342void
343glClearAccum ( r, g, b, a )
344 double r
345 double g
346 double b
347 double a
348 CODE:
349 glClearAccum((GLfloat)r,(GLfloat)g,(GLfloat)b,(GLfloat)a);
350
351void
352glClear ( m )
353 GLbitfield m
354 CODE:
355 glClear(m);
356
357void
358glFlush ()
359 CODE:
360 glFlush();
361
362void
363glFinish ()
364 CODE:
365 glFinish();
366
367void
368glRect ( r )
369 SDL_Rect* r
370 CODE:
371 glRecti(r->x,r->y,r->x+r->w,r->y+r->h);
372
373void
374glVertex ( x, y, ... )
375 double x
376 double y
377 CODE:
378 double z,w;
379 if ( items == 4 ) {
380 w = SvNV(ST(3));
381 z = SvNV(ST(2));
382 glVertex4d(x,y,z,w);
383 } else if ( items == 3 ) {
384 z = SvNV(ST(2));
385 glVertex3d(x,y,z);
386 } else {
387 glVertex2d(x,y);
388 }
389
390void
391glBegin ( mode )
392 GLenum mode
393 CODE:
394 glBegin(mode);
395
396void
397glEnd ()
398 CODE:
399 glEnd();
400
401void
402glEnable ( cap )
403 GLenum cap
404 CODE:
405 glEnable(cap);
406
407void
408glDisable ( cap )
409 GLenum cap
410 CODE:
411 glDisable(cap);
412
413void
414glGet ( param )
415 GLenum param
416 PPCODE:
417 switch (param) {
418 case GL_EDGE_FLAG_ARRAY:
419 case GL_MAP1_TEXTURE_COORD_1:
420 case GL_LIGHT_MODEL_TWO_SIDE:
421 case GL_INDEX_LOGIC_OP:
422 case GL_PACK_ALIGNMENT:
423 case GL_CLIP_PLANE4:
424 case GL_TEXTURE_GEN_S:
425 case GL_MAP1_VERTEX_3:
426 case GL_LIGHT6:
427 case GL_LIGHT0:
428 case GL_NORMAL_ARRAY:
429 case GL_EDGE_FLAG:
430 case GL_INDEX_ARRAY:
431 case GL_AUTO_NORMAL:
432 case GL_POLYGON_OFFSET_FILL:
433 case GL_MAP1_TEXTURE_COORD_4:
434 case GL_FOG:
435 case GL_LIGHT2:
436 case GL_UNPACK_SWAP_BYTES:
437 case GL_RGBA_MODE:
438 case GL_POLYGON_OFFSET_POINT:
439 case GL_POINT_SMOOTH:
440 case GL_ALPHA_TEST:
441 case GL_MAP2_TEXTURE_COORD_4:
442 case GL_COLOR_ARRAY:
443 case GL_POLYGON_OFFSET_LINE:
444 case GL_MAP2_NORMAL:
445 case GL_MAP1_INDEX:
446 case GL_PACK_LSB_FIRST:
447 case GL_MAP1_TEXTURE_COORD_2:
448 case GL_MAP2_VERTEX_3:
449 case GL_MAP2_TEXTURE_COORD_2:
450 case GL_CULL_FACE:
451 case GL_DOUBLEBUFFER:
452 case GL_UNPACK_LSB_FIRST:
453 case GL_TEXTURE_COORD_ARRAY:
454 case GL_LIGHT1:
455 case GL_TEXTURE_GEN_Q:
456 case GL_MAP_STENCIL:
457 case GL_TEXTURE_1D:
458 case GL_LIGHT4:
459 case GL_LIGHTING:
460 case GL_LIGHT7:
461 case GL_MAP1_NORMAL:
462 case GL_CLIP_PLANE0:
463 case GL_TEXTURE_GEN_R:
464 case GL_PACK_SWAP_BYTES:
465 case GL_DEPTH_WRITEMASK:
466 case GL_COLOR_LOGIC_OP:
467 case GL_CLIP_PLANE5:
468 case GL_NORMALIZE:
469 case GL_TEXTURE_2D:
470 case GL_CLIP_PLANE3:
471 case GL_COLOR_MATERIAL:
472 case GL_BLEND:
473 case GL_CLIP_PLANE2:
474 case GL_MAP1_VERTEX_4:
475 case GL_DITHER:
476 case GL_CLIP_PLANE1:
477 case GL_MAP2_INDEX:
478 case GL_POLYGON_SMOOTH:
479 case GL_STEREO:
480 case GL_MAP2_COLOR_4:
481 case GL_LIGHT3:
482 case GL_VERTEX_ARRAY:
483 case GL_MAP1_TEXTURE_COORD_3:
484 case GL_STENCIL_TEST:
485 case GL_MAP2_TEXTURE_COORD_3:
486 case GL_TEXTURE_GEN_T:
487 case GL_LIGHT_MODEL_LOCAL_VIEWER:
488 case GL_LINE_SMOOTH:
489 case GL_MAP1_COLOR_4:
490 case GL_MAP2_TEXTURE_COORD_1:
491 case GL_CURRENT_RASTER_POSITION_VALID:
492 case GL_INDEX_MODE:
493 case GL_SCISSOR_TEST:
494 case GL_MAP_COLOR:
495 case GL_POLYGON_STIPPLE:
496 case GL_LIGHT5:
497 case GL_DEPTH_TEST:
498 case GL_LINE_STIPPLE:
499 case GL_MAP2_VERTEX_4:
500 {
501 GLboolean ret[1];
502 int i;
503 glGetBooleanv(param, ret);
504
505 for (i = 0; i < 1; i++) {
506 XPUSHs(sv_2mortal(newSViv(ret[i])));
507 }
508 break;
509 }
510 case GL_COLOR_WRITEMASK:
511 {
512 GLboolean ret[4];
513 int i;
514 glGetBooleanv(param, ret);
515
516 for (i = 0; i < 4; i++) {
517 XPUSHs(sv_2mortal(newSViv(ret[i])));
518 }
519 break;
520 }
521 case GL_ZOOM_Y:
522 case GL_ALPHA_TEST_REF:
523 case GL_POINT_SIZE_GRANULARITY:
524 case GL_CURRENT_RASTER_DISTANCE:
525 case GL_ALPHA_SCALE:
526 case GL_RED_BIAS:
527 case GL_DEPTH_BIAS:
528 case GL_FOG_DENSITY:
529 case GL_GREEN_BIAS:
530 case GL_DEPTH_CLEAR_VALUE:
531 case GL_ALPHA_BIAS:
532 case GL_FOG_END:
533 case GL_GREEN_SCALE:
534 case GL_BLUE_BIAS:
535 case GL_DEPTH_SCALE:
536 case GL_POINT_SIZE:
537 case GL_POLYGON_OFFSET_FACTOR:
538 case GL_ZOOM_X:
539 case GL_FOG_START:
540 case GL_POLYGON_OFFSET_UNITS:
541 case GL_LINE_WIDTH:
542 case GL_LINE_WIDTH_GRANULARITY:
543 case GL_BLUE_SCALE:
544 case GL_RED_SCALE:
545 {
546 GLdouble ret[1];
547 int i;
548 glGetDoublev(param, ret);
549
550 for (i = 0; i < 1; i++) {
551 XPUSHs(sv_2mortal(newSVnv(ret[i])));
552 }
553 break;
554 }
555 case GL_MODELVIEW_MATRIX:
556 case GL_TEXTURE_MATRIX:
557 case GL_PROJECTION_MATRIX:
558 {
559 GLdouble ret[16];
560 int i;
561 glGetDoublev(param, ret);
562
563 for (i = 0; i < 16; i++) {
564 XPUSHs(sv_2mortal(newSVnv(ret[i])));
565 }
566 break;
567 }
568 case GL_POINT_SIZE_RANGE:
569 case GL_LINE_WIDTH_RANGE:
570 case GL_MAP1_GRID_DOMAIN:
571 case GL_DEPTH_RANGE:
572 {
573 GLdouble ret[2];
574 int i;
575 glGetDoublev(param, ret);
576
577 for (i = 0; i < 2; i++) {
578 XPUSHs(sv_2mortal(newSVnv(ret[i])));
579 }
580 break;
581 }
582 case GL_CURRENT_NORMAL:
583 {
584 GLdouble ret[3];
585 int i;
586 glGetDoublev(param, ret);
587
588 for (i = 0; i < 3; i++) {
589 XPUSHs(sv_2mortal(newSVnv(ret[i])));
590 }
591 break;
592 }
593 case GL_FOG_COLOR:
594 case GL_MAP2_GRID_DOMAIN:
595 case GL_CURRENT_RASTER_POSITION:
596 case GL_CURRENT_COLOR:
597 case GL_LIGHT_MODEL_AMBIENT:
598 case GL_CURRENT_RASTER_TEXTURE_COORDS:
599 case GL_TEXTURE_ENV_COLOR:
600 case GL_CURRENT_RASTER_COLOR:
601 case GL_CURRENT_TEXTURE_COORDS:
602 case GL_COLOR_CLEAR_VALUE:
603 case GL_ACCUM_CLEAR_VALUE:
604 {
605 GLdouble ret[4];
606 int i;
607 glGetDoublev(param, ret);
608
609 for (i = 0; i < 4; i++) {
610 XPUSHs(sv_2mortal(newSVnv(ret[i])));
611 }
612 break;
613 }
614 case GL_CULL_FACE_MODE:
615 case GL_PIXEL_MAP_I_TO_A_SIZE:
616 case GL_PIXEL_MAP_A_TO_A_SIZE:
617 case GL_BLUE_BITS:
618 case GL_EDGE_FLAG_ARRAY_STRIDE:
619 case GL_RENDER_MODE:
620 case GL_FOG_MODE:
621 case GL_DEPTH_FUNC:
622 case GL_READ_BUFFER:
623 case GL_POINT_SMOOTH_HINT:
624 case GL_PACK_SKIP_PIXELS:
625 case GL_STENCIL_REF:
626 case GL_STENCIL_CLEAR_VALUE:
627 case GL_AUX_BUFFERS:
628 case GL_COLOR_MATERIAL_PARAMETER:
629 case GL_ACCUM_BLUE_BITS:
630 case GL_INDEX_SHIFT:
631 case GL_VERTEX_ARRAY_STRIDE:
632 case GL_STENCIL_PASS_DEPTH_PASS:
633 case GL_CLIENT_ATTRIB_STACK_DEPTH:
634 case GL_DRAW_BUFFER:
635 case GL_LINE_STIPPLE_REPEAT:
636 case GL_BLEND_SRC:
637 case GL_PIXEL_MAP_B_TO_B_SIZE:
638 case GL_MAX_PIXEL_MAP_TABLE:
639 case GL_MAX_TEXTURE_SIZE:
640 case GL_PIXEL_MAP_S_TO_S_SIZE:
641 case GL_LOGIC_OP_MODE:
642 case GL_DEPTH_BITS:
643 case GL_GREEN_BITS:
644 case GL_LINE_SMOOTH_HINT:
645 case GL_ALPHA_TEST_FUNC:
646 case GL_MAX_LIGHTS:
647 case GL_FOG_HINT:
648 case GL_MAX_NAME_STACK_DEPTH:
649 case GL_INDEX_ARRAY_TYPE:
650 case GL_TEXTURE_COORD_ARRAY_TYPE:
651 case GL_COLOR_ARRAY_TYPE:
652 case GL_MAX_LIST_NESTING:
653 case GL_STENCIL_WRITEMASK:
654 case GL_LIST_BASE:
655 case GL_ACCUM_ALPHA_BITS:
656 case GL_INDEX_ARRAY_STRIDE:
657 case GL_PIXEL_MAP_I_TO_B_SIZE:
658 case GL_INDEX_BITS:
659 case GL_STENCIL_FAIL:
660 case GL_UNPACK_ALIGNMENT:
661 case GL_STENCIL_PASS_DEPTH_FAIL:
662 case GL_ATTRIB_STACK_DEPTH:
663 case GL_PACK_SKIP_ROWS:
664 case GL_TEXTURE_STACK_DEPTH:
665 case GL_MATRIX_MODE:
666 case GL_COLOR_ARRAY_STRIDE:
667 case GL_LIST_MODE:
668 case GL_UNPACK_SKIP_PIXELS:
669 case GL_PIXEL_MAP_G_TO_G_SIZE:
670 case GL_VERTEX_ARRAY_TYPE:
671 case GL_RED_BITS:
672 case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
673 case GL_INDEX_CLEAR_VALUE:
674 case GL_PIXEL_MAP_I_TO_G_SIZE:
675 case GL_ALPHA_BITS:
676 case GL_PIXEL_MAP_I_TO_R_SIZE:
677 case GL_COLOR_ARRAY_SIZE:
678 case GL_TEXTURE_COORD_ARRAY_SIZE:
679 case GL_MAP1_GRID_SEGMENTS:
680 case GL_VERTEX_ARRAY_SIZE:
681 case GL_PIXEL_MAP_R_TO_R_SIZE:
682 case GL_TEXTURE_COORD_ARRAY_STRIDE:
683 case GL_MODELVIEW_STACK_DEPTH:
684 case GL_MAX_TEXTURE_STACK_DEPTH:
685 case GL_PIXEL_MAP_I_TO_I_SIZE:
686 case GL_FOG_INDEX:
687 case GL_INDEX_WRITEMASK:
688 case GL_PACK_ROW_LENGTH:
689 case GL_CURRENT_INDEX:
690 case GL_STENCIL_VALUE_MASK:
691 case GL_UNPACK_SKIP_ROWS:
692 case GL_MAX_PROJECTION_STACK_DEPTH:
693 case GL_LIST_INDEX:
694 case GL_STENCIL_FUNC:
695 case GL_INDEX_OFFSET:
696 case GL_UNPACK_ROW_LENGTH:
697 case GL_COLOR_MATERIAL_FACE:
698 case GL_NORMAL_ARRAY_TYPE:
699 case GL_STENCIL_BITS:
700 case GL_PROJECTION_STACK_DEPTH:
701 case GL_CURRENT_RASTER_INDEX:
702 case GL_SHADE_MODEL:
703 case GL_TEXTURE_ENV_MODE:
704 case GL_NORMAL_ARRAY_STRIDE:
705 case GL_PERSPECTIVE_CORRECTION_HINT:
706 case GL_MAX_CLIP_PLANES:
707 case GL_MAX_MODELVIEW_STACK_DEPTH:
708 case GL_SUBPIXEL_BITS:
709 case GL_ACCUM_RED_BITS:
710 case GL_BLEND_DST:
711 case GL_FRONT_FACE:
712 case GL_MAX_EVAL_ORDER:
713 case GL_LINE_STIPPLE_PATTERN:
714 case GL_NAME_STACK_DEPTH:
715 case GL_MAX_ATTRIB_STACK_DEPTH:
716 case GL_POLYGON_SMOOTH_HINT:
717 case GL_ACCUM_GREEN_BITS:
718 {
719 GLint ret[1];
720 int i;
721 glGetIntegerv(param, ret);
722
723 for (i = 0; i < 1; i++) {
724 XPUSHs(sv_2mortal(newSViv(ret[i])));
725 }
726 break;
727 }
728 case GL_POLYGON_MODE:
729 case GL_MAX_VIEWPORT_DIMS:
730 case GL_MAP2_GRID_SEGMENTS:
731 {
732 GLint ret[2];
733 int i;
734 glGetIntegerv(param, ret);
735
736 for (i = 0; i < 2; i++) {
737 XPUSHs(sv_2mortal(newSViv(ret[i])));
738 }
739 break;
740 }
741 case GL_SCISSOR_BOX:
742 case GL_VIEWPORT:
743 {
744 GLint ret[4];
745 int i;
746 glGetIntegerv(param, ret);
747
748 for (i = 0; i < 4; i++) {
749 XPUSHs(sv_2mortal(newSViv(ret[i])));
750 }
751 break;
752 }
753 default:
754 croak("Unknown glGet parameter!");
755 }
756
757
758Uint32
759glIsEnabled ( cap )
760 Uint32 cap
761 CODE:
762 RETVAL = glIsEnabled(cap);
763 OUTPUT:
764 RETVAL
765
766void
767glPointSize ( size )
768 double size
769 CODE:
770 glPointSize((GLfloat)size);
771
772void
773glLineWidth ( size )
774 double size
775 CODE:
776 glLineWidth((GLfloat)size);
777
778void
779glLineStipple ( factor, pattern )
780 Sint32 factor
781 Uint16 pattern
782 CODE:
783 glLineStipple(factor,pattern);
784
785void
786glPolygonMode ( face, mode )
787 GLenum face
788 GLenum mode
789 CODE:
790 glPolygonMode(face,mode);
791
792void
793glFrontFace ( mode )
794 GLenum mode
795 CODE:
796 glFrontFace(mode);
797
798void
799glCullFace ( mode )
800 GLenum mode
801 CODE:
802 glCullFace(mode);
803
804void
805glPolygonStipple ( mask )
806 char *mask
807 CODE:
808 glPolygonStipple(mask);
809
810void
811glEdgeFlag ( flag )
812 GLenum flag
813 CODE:
814 glEdgeFlag(flag);
815
816void
817glNormal ( x, y, z )
818 double x
819 double y
820 double z
821 CODE:
822 glNormal3d(x,y,z);
823
824void
825glEnableClientState ( array )
826 GLenum array
827 CODE:
828 glEnableClientState(array);
829
830void
831glDisableClientState ( array )
832 GLenum array
833 CODE:
834 glDisableClientState(array);
835
836void
837glVertexPointer ( size, type, stride, pointer)
838 int size
839 GLenum type
840 Uint32 stride
841 char *pointer
842 CODE:
843 glVertexPointer(size,type,stride,pointer);
844
845void
846glColorPointer ( size, type, stride, pointer )
847 Sint32 size
848 GLenum type
849 Uint32 stride
850 char *pointer
851 CODE:
852 glColorPointer(size,type,stride,pointer);
853
854void
855glNormalPointer ( type, stride, pointer )
856 GLenum type
857 Uint32 stride
858 char *pointer
859 CODE:
860 glNormalPointer(type,stride,pointer);
861
862void
863glTexCoordPointer ( size, type, stride, pointer )
864 Sint32 size
865 GLenum type
866 Uint32 stride
867 char *pointer
868 CODE:
869 glTexCoordPointer(size,type,stride,pointer);
870
871void
872glEdgeFlagPointer ( stride, pointer )
873 Uint32 stride
874 char *pointer
875 CODE:
876 glEdgeFlagPointer(stride,pointer);
877
878void
879glArrayElement ( ith )
880 Uint32 ith
881 CODE:
882 glArrayElement(ith);
883
884void
885glDrawElements ( mode, count, type, indices )
886 GLenum mode
887 Uint32 count
888 GLenum type
889 char *indices
890 CODE:
891 glDrawElements( mode, count, type, indices);
892
2a668066 893#ifdef GL_VERSION_1_2
894
bfd90409 895void
896glDrawRangeElements ( mode, start, end, count, type, indices )
897 GLenum mode
898 Uint32 start
899 Uint32 end
900 Uint32 count
901 GLenum type
902 char *indices
903 CODE:
904 glDrawRangeElements(mode,start,end,count,type,indices);
905
2a668066 906#endif // GL_VERSION_1_2
907
bfd90409 908void
909glDrawArrays ( mode, first, count )
910 GLenum mode
911 Uint32 first
912 Uint32 count
913 CODE:
914 glDrawArrays(mode,first,count);
915
916void
917glInterleavedArrays ( format, stride, pointer )
918 GLenum format
919 Uint32 stride
920 char *pointer
921 CODE:
922 glInterleavedArrays(format,stride,pointer);
923
924void
925glPushAttrib ( mask )
926 GLbitfield mask
927 CODE:
928 glPushAttrib(mask);
929
930void
931glPopAttrib ()
932 CODE:
933 glPopAttrib();
934
935void
936glPushClientAttrib ( mask )
937 GLbitfield mask
938 CODE:
939 glPushClientAttrib(mask);
940
941void
942glPopClientAttrib ()
943 CODE:
944 glPopClientAttrib();
945
946void
947glMatrixMode ( mode )
948 GLenum mode
949 CODE:
950 glMatrixMode(mode);
951
952void
953glLoadIdentity ()
954 CODE:
955 glLoadIdentity();
956
957void
958glLoadMatrix ( ... )
959 CODE:
960 int i;
961 double mat[16];
962 for ( i = 0; i < 16; i++ ) {
24379be6 963 mat[i] = i < items ? SvNV(ST(i)) : 0.0;
bfd90409 964 }
965 glLoadMatrixd(mat);
966
967void
968glMultMatrix ( ... )
969 CODE:
970 int i;
971 double mat[16];
972 for ( i = 0; i < 16; i++ ) {
24379be6 973 mat[i] = i < items ? SvNV(ST(i)) : 0.0;
bfd90409 974 }
975 glMultMatrixd(mat);
976
977void
978glTranslate ( x, y, z )
979 double x
980 double y
981 double z
982 CODE:
983 glTranslated(x,y,z);
984
985void
986glRotate ( angle, x, y, z )
987 double angle
988 double x
989 double y
990 double z
991 CODE:
992 glRotated(angle,x,y,z);
993
994void
995glScale ( x, y, z )
996 double x
997 double y
998 double z
999 CODE:
1000 glScaled(x,y,z);
1001
1002void
1003glFrustum ( left, right, bottom, top, n, f )
1004 double left
1005 double right
1006 double bottom
1007 double top
1008 double n
1009 double f
1010 CODE:
1011 glFrustum(left,right,bottom,top,n,f);
1012
1013void
1014glOrtho ( left, right, bottom, top, n, f )
1015 double left
1016 double right
1017 double bottom
1018 double top
1019 double n
1020 double f
1021 CODE:
1022 glOrtho(left,right,bottom,top,n,f);
1023
1024void
1025glViewport ( x, y, width, height )
1026 Sint32 x
1027 Sint32 y
1028 Uint32 width
1029 Uint32 height
1030 CODE:
1031 glViewport(x,y,width,height);
1032
1033void
1034glDepthRange ( n, f )
1035 double n
1036 double f
1037 CODE:
1038 glDepthRange(n,f);
1039
1040void
1041glPushMatrix ()
1042 CODE:
1043 glPushMatrix();
1044
1045void
1046glPopMatrix ()
1047 CODE:
1048 glPopMatrix();
1049
1050void
1051glClipPlane ( plane, ... )
1052 GLenum plane
1053 CODE:
1054 double v[4];
1055 int i;
1056 for (i = 0; i < 4; i++ ) {
24379be6 1057 v[i] = i+1 < items ? SvNV(ST(i+1)) : 0.0;
bfd90409 1058 }
1059 glClipPlane(plane,v);
1060
1061void
1062glColor ( r, g, b, ... )
1063 double r
1064 double g
1065 double b
1066 CODE:
1067 if ( items == 4 ) {
1068 double a;
1069 a = SvNV(ST(3));
1070 glColor4d(r,g,b,a);
1071 } else {
1072 glColor3d(r,g,b);
1073 }
1074
1075void
1076glIndex ( c )
1077 Uint32 c
1078 CODE:
1079 glIndexi(c);
1080
1081void
1082glShadeModel ( mode )
1083 GLenum mode
1084 CODE:
1085 glShadeModel(mode);
1086
1087void
1088glLight ( light, name, ... )
1089 GLenum light
1090 GLenum name
1091 CODE:
1092 int i;
1093 if ( items == 6 ) {
1094 float v[4];
1095 for ( i = 0; i < 4; i++ ) {
24379be6 1096 v[i] = SvNV(ST(i+2));
bfd90409 1097 }
1098 glLightfv(light,name,v);
1099 } else if ( items == 5 ) {
1100 float v[3];
1101 for ( i = 0; i < 3; i++ ) {
24379be6 1102 v[i] = SvNV(ST(i+2));
bfd90409 1103 }
1104 glLightfv(light,name,v);
1105 } else if ( items == 3 ) {
1106 float v;
1107 v = SvNV(ST(2));
1108 glLightf(light,name,v);
1109 } else {
1110 Perl_croak(aTHX_ "SDL::OpenGL::Light invalid arguments");
1111 }
1112
1113void
1114glLightModel ( pname, ... )
1115 GLenum pname
1116 CODE:
1117 GLfloat vec[4];
1118 if ( pname == GL_LIGHT_MODEL_LOCAL_VIEWER ||
1119 pname == GL_LIGHT_MODEL_TWO_SIDE ||
1120 pname == GL_LIGHT_MODEL_COLOR_CONTROL ) {
1121 glLightModelf(pname,SvNV(ST(1)));
1122 } else if ( pname == GL_LIGHT_MODEL_AMBIENT) {
1123 vec[0] = SvNV(ST(1));
1124 vec[1] = SvNV(ST(2));
1125 vec[2] = SvNV(ST(3));
1126 vec[3] = SvNV(ST(4));
1127 glLightModelfv(pname,vec);
1128 } else {
1129 Perl_croak(aTHX_ "SDL::OpenGL::glLightModel unknown model %d",pname);
1130 }
1131
1132void
1133glMaterial ( face, name, ... )
1134 GLenum face
1135 GLenum name
1136 CODE:
1137 int i;
1138 if ( items == 6 ) {
1139 float v[4];
1140 for ( i = 0; i < 4; i++ ) {
24379be6 1141 v[i] = SvNV(ST(i+2));
bfd90409 1142 }
1143 glMaterialfv(face,name,v);
1144 } else if ( items == 5 ) {
1145 float v[3];
24379be6 1146 for ( i = 0; i < 3; i++ ) {
1147 v[i] = SvNV(ST(i+2));
bfd90409 1148 }
1149 glMaterialfv(face,name,v);
1150 } else if ( items == 3 ) {
1151 float v;
1152 v = SvNV(ST(2));
1153 glMaterialf(face,name,v);
1154 } else {
1155 Perl_croak(aTHX_ "SDL::OpenGL::Material invalid arguments");
1156 }
1157
1158void
1159glColorMaterial ( face, mode )
1160 GLenum face
1161 GLenum mode
1162 CODE:
1163 glColorMaterial(face,mode);
1164
1165void
1166glBlendFunc ( sfactor, dfactor )
1167 GLenum sfactor
1168 GLenum dfactor
1169 CODE:
1170 glBlendFunc(sfactor,dfactor);
1171
1172
1173void
1174glHint ( target, hint )
1175 GLenum target
1176 GLenum hint
1177 CODE:
1178 glHint(target,hint);
1179
1180void
1181glFog ( name, ... )
1182 GLenum name
1183 CODE:
1184 if ( items == 5 ) {
1185 float v[4];
1186 v[0] = SvNV(ST(1));
1187 v[1] = SvNV(ST(2));
1188 v[2] = SvNV(ST(3));
1189 v[3] = SvNV(ST(4));
1190 glFogfv(name,v);
1191 } else if ( items == 2 ) {
1192 float v;
1193 v = SvNV(ST(1));
1194 glFogf(name,v);
1195 } else {
1196 Perl_croak(aTHX_ "SDL::OpenGL::Material invalid arguments");
1197 }
1198
1199void
1200glPolygonOffset ( factor, units )
1201 double factor
1202 double units
1203 CODE:
1204 glPolygonOffset(factor,units);
1205
1206Uint32
1207glGenLists ( range )
1208 Uint32 range
1209 CODE:
1210 RETVAL = glGenLists(range);
1211 OUTPUT:
1212 RETVAL
1213
1214void
1215glNewList ( list, mode )
1216 Uint32 list
1217 GLenum mode
1218 CODE:
1219 glNewList(list,mode);
1220
1221void
1222glEndList ()
1223 CODE:
1224 glEndList();
1225
1226void
1227glDeleteLists ( base, count )
1228 Uint32 base
1229 Uint32 count
1230 CODE:
1231 glDeleteLists(base, count);
1232
1233void
1234glCallList ( list )
1235 Uint32 list
1236 CODE:
1237 glCallList(list);
1238
1239Uint32
1240glIsList ( list )
1241 Uint32 list
1242 CODE:
1243 RETVAL = glIsList(list);
1244 OUTPUT:
1245 RETVAL
1246
1247void
1248glListBase ( base )
1249 Uint32 base
1250 CODE:
1251 glListBase(base);
1252
1253void
1254glCallLists ( ... )
1255 CODE:
1256 int *i, j;
1257 if ( items > 0 ) {
1258 i = (int*)safemalloc(sizeof(int)* (items));
1259 for ( j = 0; j < items; j++ ) {
1260 i[j] = SvIV(ST(j));
1261 }
1262 } else {
1263 Perl_croak(aTHX_ "usage: SDL::OpenGL::CallLists(type,...)");
1264 }
1265 glCallLists(items, GL_INT, i);
1266 safefree(i);
1267
1268void
1269glCallListsString ( string )
1270 SV* string
1271 CODE:
1272 char *str;
1273 STRLEN len;
1274 str = SvPV(string,len);
1275 glCallLists(len,GL_BYTE,str);
1276
1277void
1278glRasterPos ( x, y, z, ... )
1279 double x
1280 double y
1281 double z
1282 CODE:
1283 if ( items == 4 ) {
1284 double w = SvNV(ST(3));
1285 glRasterPos4d(x,y,z,w);
1286 } else {
1287 glRasterPos3d(x,y,z);
1288 }
1289
1290void
1291glBitmap ( width, height, x1, y1, x2, y2, data )
1292 Uint32 width
1293 Uint32 height
1294 double x1
1295 double y1
1296 double x2
1297 double y2
1298 char *data
1299 CODE:
1300 glBitmap(width,height,x1,y1,x2,y2,data);
1301
1302void
1303glDrawPixels ( width, height, format, type, pixels )
1304 Uint32 width
1305 Uint32 height
1306 GLenum format
1307 GLenum type
1308 char *pixels
1309 CODE:
1310 glDrawPixels(width,height,format,type,pixels);
1311
1312
1313SV*
1314glReadPixels ( x, y, width, height, format, type )
1315 Uint32 x
1316 Uint32 y
1317 Uint32 height
1318 Uint32 width
1319 GLenum format
1320 GLenum type
1321 CODE:
1322 int len, size;
1323 char *buf;
1324 size = 1; /* ALPHA, BLUE, GREEN or RED */
1325 if (format == GL_BGR || format == GL_RGB)
1326 size = 3;
1327 if (format == GL_BGRA || format == GL_RGBA)
1328 size = 4;
1329 len = height * width * size; /* in bytes */
1330 RETVAL = newSV(len); /* alloc len+1 bytes */
1331 SvPOK_on(RETVAL); /* make an PV */
1332 buf = SvPVX(RETVAL); /* get ptr to buffer */
1333 glReadPixels(x,y,width,height,format,type,buf);
1334 SvCUR_set(RETVAL, len); /* set real length */
1335 OUTPUT:
1336 RETVAL
1337
1338AV*
1339glReadPixel ( x, y )
1340 Uint32 x
1341 Uint32 y
1342 CODE:
1343 int rgba[4]; /* r,g,b,a */
1344 int i;
1345 glReadPixels(x,y,1,1,GL_RGBA,GL_UNSIGNED_INT,rgba);
1346 RETVAL = newAV();
1347 for ( i = 0; i < 4; i++ ) {
1348 av_push(RETVAL,newSViv(rgba[i]));
1349 }
1350 OUTPUT:
1351 RETVAL
1352
1353void
1354glCopyPixels ( x, y, width, height, buffer )
1355 Sint32 x
1356 Sint32 y
1357 Uint32 width
1358 Uint32 height
1359 GLenum buffer
1360 CODE:
1361 glCopyPixels(x,y,width,height,buffer);
1362
1363void
1364glPixelStore ( name, param )
1365 Sint32 name
1366 double param
1367 CODE:
1368 glPixelStorei(name,param);
1369
1370void
1371glPixelTransfer ( name, ... )
1372 GLenum name
1373 CODE:
1374 switch ( name ) {
1375 case GL_MAP_COLOR:
1376 case GL_MAP_STENCIL:
1377 case GL_INDEX_SHIFT:
1378 case GL_INDEX_OFFSET:
1379 glPixelTransferi(name,SvIV(ST(1)));
1380 break;
1381 default:
1382 glPixelTransferf(name,SvNV(ST(1)));
1383 break;
1384 }
1385
1386void
1387glPixelMap ( type, map, mapsize, values )
1388 GLenum type
1389 GLenum map
1390 Sint32 mapsize
1391 char *values
1392 CODE:
1393 switch (type) {
1394 case GL_UNSIGNED_INT:
1395 glPixelMapuiv(map,mapsize,(GLint*)values);
1396 break;
1397 case GL_UNSIGNED_SHORT:
1398 glPixelMapusv(map,mapsize,(GLushort*)values);
1399 break;
1400 case GL_FLOAT:
1401 glPixelMapfv(map,mapsize,(GLfloat*)values);
1402 break;
1403 }
1404
1405void
1406glPixelZoom ( zoomx, zoomy )
1407 double zoomx
1408 double zoomy
1409 CODE:
1410 glPixelZoom(zoomx,zoomy);
1411
1412#ifdef GL_VERSION_1_3
1413
1414void
1415glColorTable ( target, internalFormat, width, format, type, data )
1416 GLenum target
1417 GLenum internalFormat
1418 Uint32 width
1419 GLenum format
1420 GLenum type
1421 char *data
1422 CODE:
1423 glColorTable(target,internalFormat,width,format,type,data);
1424
1425void
1426glColorTableParameter ( target, name, r, g, b, a)
1427 GLenum target
1428 GLenum name
1429 double r
1430 double g
1431 double b
1432 double a
1433 CODE:
1434 GLfloat vec[4];
1435 vec[0] = r;
1436 vec[1] = g;
1437 vec[2] = b;
1438 vec[3] = a;
1439 glColorTableParameterfv(target,name,vec);
1440
1441void
1442glCopyColorTable ( target, internalFormat, x, y, width )
1443 GLenum target
1444 GLenum internalFormat
1445 Sint32 x
1446 Sint32 y
1447 Uint32 width
1448 CODE:
1449 glCopyColorTable(target,internalFormat,x,y,width);
1450
1451void
1452glColorSubTable ( target, start, count, format, type, data )
1453 Uint32 target
1454 Uint32 start
1455 Uint32 count
1456 Uint32 format
1457 Uint32 type
1458 char *data
1459 CODE:
1460 glColorSubTable(target,start,count,format,type,data);
1461
1462void
1463glCopyColorSubTable ( target, start, x, y, count )
1464 Uint32 target
1465 Uint32 start
1466 Sint32 x
1467 Sint32 y
1468 Uint32 count
1469 CODE:
1470 glCopyColorSubTable(target,start,x,y,count);
1471
1472void
1473glConvolutionFilter2D ( target, internalFormat, width, height, format, type, image )
1474 Uint32 target
1475 Uint32 internalFormat
1476 Uint32 width
1477 Uint32 height
1478 Uint32 format
1479 Uint32 type
1480 char *image
1481 CODE:
1482 glConvolutionFilter2D(target,internalFormat,width,height,format,type,image);
1483
1484void
1485glCopyConvolutionFilter2D ( target, internalFormat, x, y, width, height )
1486 Uint32 target
1487 Uint32 internalFormat
1488 Sint32 x
1489 Sint32 y
1490 Uint32 width
1491 Uint32 height
1492 CODE:
1493 glCopyConvolutionFilter2D(target,internalFormat,x,y,width,height);
1494
1495void
1496glSeparableFilter2D ( target, internalFormat, width, height, format, type, row, column )
1497 Uint32 target
1498 Uint32 internalFormat
1499 Uint32 width
1500 Uint32 height
1501 Uint32 format
1502 Uint32 type
1503 char *row
1504 char *column
1505 CODE:
1506 glSeparableFilter2D(target,internalFormat,width,height,format,type,row,column);
1507
1508void
1509glConvolutionFilter1D ( target, internalFormat, width, format, type, image )
1510 Uint32 target
1511 Uint32 internalFormat
1512 Uint32 width
1513 Uint32 format
1514 Uint32 type
1515 char *image
1516 CODE:
1517 glConvolutionFilter1D(target,internalFormat,width,format,type,image);
1518
1519void
1520glCopyConvolutionFilter1D ( target, internalFormat, x, y, width )
1521 Uint32 target
1522 Uint32 internalFormat
1523 Sint32 x
1524 Sint32 y
1525 Uint32 width
1526 CODE:
1527 glCopyConvolutionFilter1D(target,internalFormat,x,y,width);
1528
1529void
1530glConvolutionParameter ( target, pname, ... )
1531 Uint32 target
1532 Uint32 pname
1533 CODE:
1534 Uint32 pi;
1535 GLfloat pv[4];
1536 switch(pname) {
1537 case GL_CONVOLUTION_BORDER_MODE:
1538 if ( items != 3 )
1539 Perl_croak(aTHX_ "Usage: ConvolutionParameter(target,pname,...)");
1540 pi = SvIV(ST(2));
1541 glConvolutionParameteri(target,pname,pi);
1542 break;
1543 case GL_CONVOLUTION_FILTER_SCALE:
1544 case GL_CONVOLUTION_FILTER_BIAS:
1545 if ( items != 6 )
1546 Perl_croak(aTHX_ "Usage: ConvolutionParameter(target,pname,...)");
1547 pv[0] = (GLfloat)SvNV(ST(2));
1548 pv[1] = (GLfloat)SvNV(ST(3));
1549 pv[2] = (GLfloat)SvNV(ST(4));
1550 pv[3] = (GLfloat)SvNV(ST(5));
1551 glConvolutionParameterfv(target,pname,pv);
1552 break;
1553 default:
1554 Perl_croak(aTHX_ "ConvolutionParameter invalid parameter");
1555 break;
1556 }
1557
1558void
1559glHistogram ( target, width, internalFormat, sink )
1560 Uint32 target
1561 Uint32 width
1562 Uint32 internalFormat
1563 GLboolean sink
1564 CODE:
1565 glHistogram(target,width,internalFormat,sink);
1566
1567void
1568glGetHistogram ( target, reset, format, type, values )
1569 Uint32 target
1570 GLboolean reset
1571 Uint32 format
1572 Uint32 type
1573 char *values
1574 CODE:
1575 glGetHistogram(target,reset,format,type,values);
1576
1577void
1578glResetHistogram ( target )
1579 Uint32 target
1580 CODE:
1581 glResetHistogram(target);
1582
1583void
1584glMinmax ( target, internalFormat, sink )
1585 Uint32 target
1586 Uint32 internalFormat
1587 GLboolean sink
1588 CODE:
1589 glMinmax(target,internalFormat,sink);
1590
1591void
1592glGetMinmax ( target, reset, format, type, values )
1593 Uint32 target
1594 GLboolean reset
1595 Uint32 format
1596 Uint32 type
1597 char *values
1598 CODE:
1599 glGetMinmax(target,reset,format,type,values);
1600
1601void
1602glResetMinmax ( target )
1603 Uint32 target
1604 CODE:
1605 glResetMinmax(target);
1606
1607void
1608glBlendEquation ( mode )
1609 Uint32 mode
1610 CODE:
1611 glBlendEquation(mode);
1612
1613#endif // GL_VERSION_1_3
1614
1615void
1616glTexImage2D ( target, level, internalFormat, width, height, border, format, type, data )
1617 GLenum target
1618 Sint32 level
1619 Sint32 internalFormat
1620 Uint32 width
1621 Uint32 height
1622 Sint32 border
1623 GLenum format
1624 GLenum type
1625 char *data
1626 CODE:
1627 glTexImage2D(target,level,internalFormat,width,height,border,format,type,data);
1628
1629void
1630glCopyTexImage2D ( target, level, internalFormat, x, y, width, height, border )
1631 GLenum target
1632 Sint32 level
1633 Sint32 internalFormat
1634 Sint32 x
1635 Sint32 y
1636 Uint32 width
1637 Uint32 height
1638 Sint32 border
1639 CODE:
1640 glCopyTexImage2D(target,level,internalFormat,x,y,width,height,border);
1641
1642void
1643glTexSubImage2D ( target, level, xoffset, yoffset, width, height, format, type, data )
1644 GLenum target
1645 Sint32 level
1646 Sint32 xoffset
1647 Sint32 yoffset
1648 Uint32 width
1649 Uint32 height
1650 GLenum format
1651 GLenum type
1652 char *data
1653 CODE:
1654 glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,data);
1655
1656void
1657glCopyTexSubImage2D ( target, level, xoffset, yoffset, x, y, width, height )
1658 GLenum target
1659 Sint32 level
1660 Sint32 xoffset
1661 Sint32 yoffset
1662 Sint32 x
1663 Sint32 y
1664 Uint32 width
1665 Uint32 height
1666 CODE:
1667 glCopyTexSubImage2D(target,level,xoffset,yoffset,x,y,width,height);
1668
1669void
1670glTexImage1D ( target, level, internalFormat, width, border, format, type, data )
1671 GLenum target
1672 Sint32 level
1673 Sint32 internalFormat
1674 Uint32 width
1675 Sint32 border
1676 GLenum format
1677 GLenum type
1678 char *data
1679 CODE:
1680 glTexImage1D(target,level,internalFormat,width,border,format,type,data);
1681
1682void
1683glTexSubImage1D ( target, level, xoffset, width, format, type, data )
1684 GLenum target
1685 Sint32 level
1686 Sint32 xoffset
1687 Uint32 width
1688 GLenum format
1689 GLenum type
1690 char *data
1691 CODE:
1692 glTexSubImage1D(target,level,xoffset,width,format,type,data);
1693
1694void
1695glCopyTexImage1D ( target, level, internalFormat, x, y, width, border )
1696 GLenum target
1697 Sint32 level
1698 Sint32 internalFormat
1699 Sint32 x
1700 Sint32 y
1701 Uint32 width
1702 Sint32 border
1703 CODE:
1704 glCopyTexImage1D(target,level,internalFormat,x,y,width,border);
1705
1706void
1707glCopyTexSubImage1D ( target, level, xoffset, x, y, width )
1708 GLenum target
1709 Sint32 level
1710 Sint32 xoffset
1711 Sint32 x
1712 Sint32 y
1713 Uint32 width
1714 CODE:
1715 glCopyTexSubImage1D(target,level,xoffset,x,y,width);
1716
1717#ifdef GL_VERSION_1_3
1718
1719void
1720glTexImage3D ( target, level, internalFormat, width, height, depth, border, format, type, data )
1721 GLenum target
1722 Sint32 level
1723 Sint32 internalFormat
1724 Uint32 width
1725 Uint32 height
1726 Uint32 depth
1727 Sint32 border
1728 GLenum format
1729 GLenum type
1730 char *data
1731 CODE:
1732 glTexImage3D(target,level,internalFormat,width,height,depth,border,format,type,data);
1733
1734void
1735glTexSubImage3D ( target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, data )
1736 GLenum target
1737 Sint32 level
1738 Sint32 xoffset
1739 Sint32 yoffset
1740 Sint32 zoffset
1741 Uint32 width
1742 Uint32 height
1743 Uint32 depth
1744 GLenum format
1745 GLenum type
1746 char *data
1747 CODE:
1748 glTexSubImage3D(target,level,xoffset,yoffset,zoffset,
1749 width,height,depth,format,type,data);
1750
1751void
1752glCopyTexSubImage3D ( target, level, xoffset, yoffset, zoffset, x, y, width, height )
1753 GLenum target
1754 Sint32 level
1755 Sint32 xoffset
1756 Sint32 yoffset
1757 Sint32 zoffset
1758 Sint32 x
1759 Sint32 y
1760 Uint32 width
1761 Uint32 height
1762 CODE:
1763 glCopyTexSubImage3D(target,level,xoffset,yoffset,zoffset,x,y,width,height);
1764
1765#endif // GL_VERSION_1_3
1766
1767AV*
1768glGenTextures ( n )
1769 Uint32 n;
1770 CODE:
1771 GLsizei i;
1772 GLuint* names;
1773 names = (GLuint*)safemalloc(sizeof(GLuint)*n);
1774 RETVAL = newAV();
1775 glGenTextures(n,names);
1776 for ( i = 0; i < n; i++ ) {
1777 av_push(RETVAL,newSViv(names[i]));
1778 }
1779 safefree(names);
1780 OUTPUT:
1781 RETVAL
1782
1783GLboolean
1784glIsTexture ( texture )
1785 Uint32 texture
1786 CODE:
1787 RETVAL = glIsTexture(texture);
1788 OUTPUT:
1789 RETVAL
1790
1791void
1792glBindTexture ( target, texture )
1793 GLenum target
1794 Uint32 texture
1795 CODE:
1796 glBindTexture(target,texture);
1797
1798void
1799glDeleteTextures ( ... )
1800 CODE:
1801 GLuint* textures;
1802 int i;
1803 textures = (GLuint*)safemalloc(sizeof(GLuint) * items);
1804 if ( textures ) {
1805 for ( i = 0; i < items; i++ ) {
1806 textures[i] = SvIV(ST(i));
1807 }
1808 }
1809 glDeleteTextures(items,textures);
1810 safefree(textures);
1811
1812AV*
1813glAreTexturesResident ( ... )
1814 CODE:
1815 GLuint* textures;
1816 GLboolean *homes;
1817 int i;
1818 RETVAL = newAV();
1819 textures = (GLuint*)safemalloc(sizeof(GLuint) * items);
1820 homes = (GLboolean*)safemalloc(sizeof(GLboolean) * items);
1821 if ( textures ) {
1822 for ( i = 0; i < items; i++ ) {
1823 textures[i] = SvIV(ST(i));
1824 }
1825 }
1826 if ( GL_FALSE != glAreTexturesResident(items,textures,homes)) {
1827 for (i = 0; i < items; i++ ) {
1828 av_push(RETVAL,newSViv(homes[i]));
1829 }
1830 }
1831 safefree(homes);
1832 safefree(textures);
1833 OUTPUT:
1834 RETVAL
1835
1836void
1837glPrioritizeTextures ( n, names, priorities )
1838 Uint32 n
1839 char *names
1840 char *priorities
1841 CODE:
1842 glPrioritizeTextures(n,(GLuint*)names,(const GLclampf *)priorities);
1843
1844void
1845glTexEnv ( target, name, ... )
1846 GLenum target
1847 GLenum name
1848 CODE:
1849 float pv[4];
1850 GLint p;
1851 switch(name) {
1852 case GL_TEXTURE_ENV_MODE:
1853 p = SvIV(ST(2));
1854 glTexEnvi(target,name,p);
1855 break;
1856 case GL_TEXTURE_ENV_COLOR:
1857 pv[0] = SvNV(ST(2));
1858 pv[1] = SvNV(ST(3));
1859 pv[2] = SvNV(ST(4));
1860 pv[3] = SvNV(ST(5));
1861 glTexEnvfv(target,name,pv);
1862 break;
1863 }
1864
1865void
1866glTexCoord ( ... )
1867 CODE:
1868 double s,t,r,q;
1869 if ( items < 1 || items > 4 )
1870 Perl_croak (aTHX_ "usage: SDL::OpenGL::TexCoord(s,[t,[r,[q]]])");
1871 s = t = r = 0.0;
1872 q = 1.0;
1873 switch(items) {
1874 case 4:
1875 q = SvNV(ST(3));
1876 case 3:
1877 r = SvNV(ST(2));
1878 case 2:
1879 t = SvNV(ST(1));
1880 case 1:
1881 s = SvNV(ST(0));
1882 }
1883 glTexCoord4d(s,t,r,q);
1884
1885void
1886glTexParameter ( target, name, ... )
1887 GLenum target
1888 GLenum name
1889 CODE:
1890 GLfloat pv[4];
1891 GLint p;
1892 switch (name) {
1893 case GL_TEXTURE_BORDER_COLOR:
1894 pv[0] = SvNV(ST(2));
1895 pv[1] = SvNV(ST(3));
1896 pv[2] = SvNV(ST(4));
1897 pv[3] = SvNV(ST(5));
1898 glTexParameterfv(target,name,pv);
1899 break;
1900 case GL_TEXTURE_PRIORITY:
1901 case GL_TEXTURE_MIN_LOD:
1902 case GL_TEXTURE_MAX_LOD:
1903 pv[0] = SvNV(ST(2));
1904 glTexParameterf(target,name,pv[0]);
1905 break;
1906 case GL_TEXTURE_BASE_LEVEL:
1907 case GL_TEXTURE_MAX_LEVEL:
1908 default:
1909 p = SvIV(ST(2));
1910 glTexParameteri(target,name,p);
1911 break;
1912 }
1913
1914void
1915glTexGen ( coord, name, ... )
1916 GLenum coord
1917 GLenum name
1918 CODE:
1919 GLdouble *pv;
1920 GLint p;
1921 int i;
1922 switch (name) {
1923 case GL_TEXTURE_GEN_MODE:
1924 p = SvIV(ST(2));
1925 glTexGeni(coord,name,p);
1926 break;
1927 default:
1928 if ( items == 2 )
1929 Perl_croak(aTHX_ "usage: glTexGen(coord,name,...)");
1930 pv = (GLdouble*)safemalloc(sizeof(GLdouble)*(items-2));
1931 for ( i = 0; i < items - 2; i++ ) {
1932 pv[i] = SvNV(ST(i+2));
1933 }
1934 glTexGendv(coord,name,pv);
1935 safefree(pv);
1936 break;
1937 }
1938
1939#ifdef GL_VERSION_1_3
1940
1941void
1942glActiveTextureARB ( texUnit )
1943 GLenum texUnit
1944 CODE:
1945 glActiveTextureARB(texUnit);
1946
1947void
1948glMultiTexCoord ( texUnit, ... )
1949 Uint32 texUnit
1950 CODE:
1951 double s,t,r,q;
1952 if ( items < 2 || items > 5 )
1953 Perl_croak (aTHX_ "usage: SDL::OpenGL::MultiTexCoord(tex,s,[t,[r,[q]]])");
1954 s = t = r = 0.0;
1955 q = 1.0;
1956 switch(items) {
1957 case 5:
1958 q = SvNV(ST(3));
1959 case 4:
1960 r = SvNV(ST(2));
1961 case 3:
1962 t = SvNV(ST(1));
1963 case 2:
1964 s = SvNV(ST(0));
1965 }
1966 glMultiTexCoord4dARB(texUnit,s,t,r,q);
1967
1968#endif // GL_VERSION_1_3
1969
1970void
1971glDrawBuffer ( mode )
1972 GLenum mode
1973 CODE:
1974 glDrawBuffer(mode);
1975
1976void
1977glReadBuffer ( mode )
1978 GLenum mode
1979 CODE:
1980 glReadBuffer(mode);
1981
1982void
1983glIndexMask ( mask )
1984 Uint32 mask
1985 CODE:
1986 glIndexMask(mask);
1987
1988void
1989glColorMask ( red, green, blue, alpha )
1990 GLboolean red
1991 GLboolean green
1992 GLboolean blue
1993 GLboolean alpha
1994 CODE:
1995 glColorMask(red,green,blue,alpha);
1996
1997void
1998glDepthMask ( flag )
1999 GLboolean flag
2000 CODE:
2001 glDepthMask(flag);
2002
2003void
2004glStencilMask ( mask )
2005 Uint32 mask
2006 CODE:
2007 glStencilMask(mask);
2008
2009void
2010glScissor ( x , y, width, height )
2011 Sint32 x
2012 Sint32 y
2013 Uint32 width
2014 Uint32 height
2015 CODE:
2016 glScissor(x,y,width,height);
2017
2018void
2019glAlphaFunc ( func, ref )
2020 GLenum func
2021 double ref
2022 CODE:
2023 glAlphaFunc(func,ref);
2024
2025void
2026glStencilFunc ( func, ref, mask )
2027 GLenum func
2028 Sint32 ref
2029 Uint32 mask
2030 CODE:
2031 glStencilFunc(func,ref,mask);
2032
2033void
2034glStencilOp ( fail, zfail, zpass )
2035 GLenum fail
2036 GLenum zfail
2037 GLenum zpass
2038 CODE:
2039 glStencilOp(fail,zfail,zpass);
2040
2041void
2042glDepthFunc ( func )
2043 GLenum func
2044 CODE:
2045 glDepthFunc(func);
2046
2047void
2048glLogicOp ( opcode )
2049 GLenum opcode
2050 CODE:
2051 glLogicOp(opcode);
2052
2053void
2054glAccum ( op, value )
2055 GLenum op
2056 double value
2057 CODE:
2058 glAccum(op,value);
2059
2060void
2061glMap1 ( target, u1, u2, stride, order, points )
2062 GLenum target
2063 double u1
2064 double u2
2065 Sint32 stride
2066 Sint32 order
2067 char *points
2068 CODE:
2069 glMap1d(target,u1,u2,stride,order,(double*)points);
2070
2071void
2072glEvalCoord1 ( u )
2073 double u
2074 CODE:
2075 glEvalCoord1d(u);
2076
2077void
2078glMapGrid1 ( n, u1, u2 )
2079 Sint32 n
2080 double u1
2081 double u2
2082 CODE:
2083 glMapGrid1d(n,u1,u2);
2084
2085void
2086glEvalMesh1 ( mode, p1, p2 )
2087 GLenum mode
2088 Sint32 p1
2089 Sint32 p2
2090 CODE:
2091 glEvalMesh1(mode,p1,p2);
2092
2093void
2094glMap2 ( target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points )
2095 GLenum target
2096 double u1
2097 double u2
2098 Sint32 ustride
2099 Sint32 uorder
2100 double v1
2101 double v2
2102 Sint32 vstride
2103 Sint32 vorder
2104 char *points
2105 CODE:
2106 glMap2d(target,u1,u2,ustride,uorder,v1,v2,vstride,vorder,(double*)points);
2107
2108void
2109glEvalCoord2 ( u, v )
2110 double u
2111 double v
2112 CODE:
2113 glEvalCoord2d(u,v);
2114
2115void
2116glMapGrid2 ( nu, u1, u2, nv, v1, v2 )
2117 Sint32 nu
2118 double u1
2119 double u2
2120 Sint32 nv
2121 double v1
2122 double v2
2123 CODE:
2124 glMapGrid2d(nu,u1,u2,nv,v1,v2);
2125
2126void
2127glEvalMesh2 ( mode, i1, i2, j1, j2 )
2128 GLenum mode
2129 Sint32 i1
2130 Sint32 i2
2131 Sint32 j1
2132 Sint32 j2
2133 CODE:
2134 glEvalMesh2(mode,i1,i2,j1,j2);
2135
2136GLenum
2137glGetError ( )
2138 CODE:
2139 RETVAL = glGetError();
2140 OUTPUT:
2141 RETVAL
2142
2143GLint
2144glRenderMode ( mode )
2145 GLenum mode
2146 CODE:
2147 RETVAL = glRenderMode( mode );
2148 OUTPUT:
2149 RETVAL
2150
2151void
2152glInitNames ( )
2153 CODE:
2154 glInitNames();
2155
2156void
2157glPushName ( name )
2158 GLuint name
2159 CODE:
2160 glPushName(name);
2161
2162void
2163glPopName ( )
2164 CODE:
2165 glPopName();
2166
2167void
2168glLoadName ( name )
2169 GLuint name
2170 CODE:
2171 glLoadName(name);
2172
2173void
2174glFeedbackBuffer ( size, type, buffer )
2175 GLuint size
2176 GLenum type
2177 float* buffer
2178 CODE:
2179 glFeedbackBuffer(size,type,buffer);
2180
2181void
2182glPassThrough ( token )
2183 GLfloat token
2184 CODE:
2185 glPassThrough(token);
2186
2187
2188#endif
2189
2190#ifdef HAVE_GLU
2191
2192void
2193gluLookAt ( eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz )
2194 double eyex
2195 double eyey
2196 double eyez
2197 double centerx
2198 double centery
2199 double centerz
2200 double upx
2201 double upy
2202 double upz
2203 CODE:
2204 gluLookAt(eyex,eyey,eyez,centerx,centery,centerz,upx,upy,upz);
2205
2206void
2207gluPerspective ( fovy, aspect, n, f )
2208 double fovy
2209 double aspect
2210 double n
2211 double f
2212 CODE:
2213 gluPerspective(fovy,aspect,n,f);
2214
2215void
2216gluPickMatrix ( x, y, delx, dely, viewport )
2217 double x
2218 double y
2219 double delx
2220 double dely
2221 GLint* viewport
2222 CODE:
2223 gluPickMatrix(x,y,delx,dely,viewport);
2224
2225void
2226gluOrtho2D ( left, right, bottom, top )
2227 double left
2228 double right
2229 double bottom
2230 double top
2231 CODE:
2232 gluOrtho2D(left,right,bottom,top);
2233
2234int
2235gluScaleImage ( format, widthin, heightin, typein, datain, widthout, heightout, typeout, dataout )
2236 GLenum format
2237 Uint32 widthin
2238 Uint32 heightin
2239 GLenum typein
2240 char *datain
2241 Uint32 widthout
2242 Uint32 heightout
2243 GLenum typeout
2244 char *dataout
2245 CODE:
2246 RETVAL = gluScaleImage(format,widthin,heightin,typein,datain,
2247 widthout,heightout,typeout,dataout);
2248 OUTPUT:
2249 RETVAL
2250
2251int
2252gluBuild1DMipmaps ( target, internalFormat, width, format, type, data )
2253 GLenum target
2254 Sint32 internalFormat
2255 Uint32 width
2256 GLenum format
2257 GLenum type
2258 char *data
2259 CODE:
2260 RETVAL = gluBuild1DMipmaps(target,internalFormat,width,format,type,data);
2261 OUTPUT:
2262 RETVAL
2263
2264int
2265gluBuild2DMipmaps ( target, internalFormat, width, height, format, type, data )
2266 GLenum target
2267 Sint32 internalFormat
2268 Uint32 width
2269 Uint32 height
2270 GLenum format
2271 GLenum type
2272 char *data
2273 CODE:
2274 RETVAL = gluBuild2DMipmaps(target,internalFormat,width,height,format,type,data);
2275 OUTPUT:
2276 RETVAL
2277
2278
2279#if HAVE_GLU_VERSION >= 12
2280int
2281gluBuild3DMipmaps ( target, internalFormat, width, height, depth, format, type, data )
2282 GLenum target
2283 Sint32 internalFormat
2284 Uint32 width
2285 Uint32 height
2286 Uint32 depth
2287 GLenum format
2288 GLenum type
2289 char *data
2290 CODE:
2291 RETVAL = gluBuild3DMipmaps(target,internalFormat,width,height,depth,
2292 format,type,data);
2293 OUTPUT:
2294 RETVAL
2295
2296#else
2297void
2298gluBuild3DMipmaps ( )
2299 CODE:
2300 Perl_croak (aTHX_ "SDL::OpenGL::Build3DMipmaps requires GLU 1.2");
2301
2302#endif
2303
2304#if HAVE_GLU_VERSION >= 12
2305int
2306gluBuild1DMipmapLevels ( target, internalFormat, width, format, type, level, base, max, data )
2307 GLenum target
2308 Sint32 internalFormat
2309 Uint32 width
2310 GLenum format
2311 GLenum type
2312 Sint32 level
2313 Sint32 base
2314 Sint32 max
2315 char *data
2316 CODE:
2317 RETVAL = gluBuild1DMipmapLevels(target,internalFormat,width,
2318 format,type,level,base,max,data);
2319 OUTPUT:
2320 RETVAL
2321
2322#else
2323void
2324gluBuild1DMipmapLevels ()
2325 CODE:
2326 Perl_croak(aTHX_ "SDL::OpenGL::Build1DMipmapLevels requires GLU 1.2");
2327
2328#endif
2329
2330#if HAVE_GLU_VERSION >= 12
2331int
2332gluBuild2DMipmapLevels ( target, internalFormat, width, height, format, type, level, base, max, data )
2333 GLenum target
2334 Sint32 internalFormat
2335 Uint32 width
2336 Uint32 height
2337 GLenum format
2338 GLenum type
2339 Sint32 level
2340 Sint32 base
2341 Sint32 max
2342 char *data
2343 CODE:
2344 RETVAL = gluBuild2DMipmapLevels(target,internalFormat,width,height,
2345 format,type,level,base,max,data);
2346 OUTPUT:
2347 RETVAL
2348
2349#else
2350void
2351gluBuild2DMipmapLevels ()
2352 CODE:
2353 Perl_croak(aTHX_ "SDL::OpenGL::Build2DMipmapLevels requires GLU 1.2");
2354
2355#endif
2356
2357#if HAVE_GLU_VERSION >= 12
2358int
2359gluBuild3DMipmapLevels ( target, internalFormat, width, height, depth, format, type, level, base, max, data )
2360 GLenum target
2361 Sint32 internalFormat
2362 Uint32 width
2363 Uint32 height
2364 Uint32 depth
2365 GLenum format
2366 GLenum type
2367 Sint32 level
2368 Sint32 base
2369 Sint32 max
2370 char *data
2371 CODE:
2372 RETVAL = gluBuild3DMipmapLevels(target,internalFormat,width,height,depth,
2373 format,type,level,base,max,data);
2374 OUTPUT:
2375 RETVAL
2376
2377#else
2378void
2379gluBuild3DMipmapLevels ()
2380 CODE:
2381 Perl_croak(aTHX_ "SDL::OpenGL::Build3DMipmapLevels requires GLU 1.2");
2382
2383#endif
2384
2385char*
2386gluErrorString ( code )
2387 GLenum code
2388 CODE:
2389 RETVAL = (char*)gluErrorString(code);
2390 OUTPUT:
2391 RETVAL
2392
2393GLUnurbsObj*
2394gluNewNurbsRenderer ()
2395 CODE:
2396 RETVAL = gluNewNurbsRenderer();
2397 OUTPUT:
2398 RETVAL
2399
2400void
2401gluDeleteNurbsRenderer ( obj )
2402 GLUnurbsObj *obj
2403 CODE:
2404 gluDeleteNurbsRenderer(obj);
2405
2406void
2407gluNurbsProperty ( obj, property, value )
2408 GLUnurbsObj *obj
2409 GLenum property
2410 double value
2411 CODE:
2412 gluNurbsProperty(obj,property,(float)value);
2413
2414void
2415gluLoadSamplingMatrices ( obj, mm, pm, vp )
2416 GLUnurbsObj *obj
2417 char *mm
2418 char *pm
2419 char *vp
2420 CODE:
2421 gluLoadSamplingMatrices(obj,(GLfloat*)mm,(GLfloat*)pm,(GLint*)vp);
2422
2423double
2424gluGetNurbsProperty ( obj, property )
2425 GLUnurbsObj *obj
2426 GLenum property
2427 CODE:
2428 float f;
2429 gluGetNurbsProperty(obj,property,&f);
2430 RETVAL = (double)f;
2431 OUTPUT:
2432 RETVAL
2433
2434void
2435gluNurbsCallback ( obj, which, cb )
2436 GLUnurbsObj *obj
2437 GLenum which
2438 SV *cb
2439 CODE:
2440 switch(which) {
2441 case GLU_ERROR:
2442 sdl_perl_nurbs_error_hook = cb;
2443 gluNurbsCallback(obj,GLU_ERROR,(GLvoid*)sdl_perl_nurbs_error_callback);
2444 break;
2445#ifdef GLU_NURBS_BEGIN
2a668066 2446#ifdef GLU_VERSION_1_3
bfd90409 2447 case GLU_NURBS_BEGIN:
2448 case GLU_NURBS_BEGIN_DATA:
2a668066 2449
bfd90409 2450 gluNurbsCallbackData(obj,(void*)cb);
2451 gluNurbsCallback(obj,GLU_NURBS_BEGIN_DATA,
2452 (GLvoid*)sdl_perl_nurbs_being_callback);
2453 break;
2454 case GLU_NURBS_TEXTURE_COORD:
2455 case GLU_NURBS_TEXTURE_COORD_DATA:
2456 gluNurbsCallbackData(obj,(void*)cb);
2457 gluNurbsCallback(obj,GLU_NURBS_TEXTURE_COORD_DATA,
2458 (GLvoid*)sdl_perl_nurbs_multi_callback);
2459 break;
2460 case GLU_NURBS_COLOR:
2461 case GLU_NURBS_COLOR_DATA:
2462 gluNurbsCallbackData(obj,(void*)cb);
2463 gluNurbsCallback(obj,GLU_NURBS_COLOR_DATA,
2464 (GLvoid*)sdl_perl_nurbs_multi_callback);
2465 break;
2466 case GLU_NURBS_NORMAL:
2467 case GLU_NURBS_NORMAL_DATA:
2468 gluNurbsCallbackData(obj,(void*)cb);
2469 gluNurbsCallback(obj,GLU_NURBS_NORMAL_DATA,
2470 (GLvoid*)sdl_perl_nurbs_multi_callback);
2471 break;
2472 case GLU_NURBS_VERTEX:
2473 case GLU_NURBS_VERTEX_DATA:
2474 gluNurbsCallbackData(obj,(void*)cb);
2475 gluNurbsCallback(obj,GLU_NURBS_VERTEX_DATA,
2476 (GLvoid*)sdl_perl_nurbs_multi_callback);
2477 break;
2478 case GLU_NURBS_END:
2479 case GLU_NURBS_END_DATA:
2480 gluNurbsCallbackData(obj,(void*)cb);
2481 gluNurbsCallback(obj,GLU_NURBS_END_DATA,
2482 (GLvoid*)sdl_perl_nurbs_end_callback);
2483 break;
2a668066 2484#endif // GLU_VERSION_1_3
2485#endif // GLU_NURBS_BEGIN
bfd90409 2486 default:
2487 Perl_croak(aTHX_ "SDL::OpenGL::NurbsCallback - invalid type");
2488 }
2489
2a668066 2490#ifdef GLU_VERSION_1_3
2491
bfd90409 2492void
2493gluNurbsCallbackData ( obj, cb )
2494 GLUnurbsObj *obj
2495 SV *cb
2496 CODE:
2497 gluNurbsCallbackData(obj,(void*)cb);
2498
2a668066 2499#endif
2500
bfd90409 2501void
2502gluBeginSurface ( obj )
2503 GLUnurbsObj *obj
2504 CODE:
2505 gluBeginSurface(obj);
2506
2507void
2508gluEndSurface ( obj )
2509 GLUnurbsObj *obj
2510 CODE:
2511 gluEndSurface(obj);
2512
2513void
2514gluNurbsSurface ( obj, uknot_count, uknot, vknot_count, vknot, u_stride, v_stride, ctlarray, uorder, vorder, type )
2515 GLUnurbsObj *obj
2516 Sint32 uknot_count
2517 char *uknot
2518 Sint32 vknot_count
2519 char *vknot
2520 Sint32 u_stride
2521 Sint32 v_stride
2522 char *ctlarray
2523 Sint32 uorder
2524 Sint32 vorder
2525 GLenum type
2526 CODE:
2527 gluNurbsSurface(obj,uknot_count,(GLfloat*)uknot,vknot_count,(GLfloat*)vknot,
2528 u_stride,v_stride,(GLfloat*)ctlarray,uorder,vorder,type);
2529
2530void
2531gluBeginCurve ( obj )
2532 GLUnurbsObj *obj
2533 CODE:
2534 gluBeginCurve(obj);
2535
2536void
2537gluEndCurve ( obj )
2538 GLUnurbsObj *obj
2539 CODE:
2540 gluEndCurve(obj);
2541
2542void
2543gluNurbsCurve ( obj, uknot_count, uknot, u_stride, ctlarray, uorder, type )
2544 GLUnurbsObj *obj
2545 Sint32 uknot_count
2546 char *uknot
2547 Sint32 u_stride
2548 char *ctlarray
2549 Sint32 uorder
2550 GLenum type
2551 CODE:
2552 gluNurbsCurve(obj,uknot_count,(GLfloat*)uknot,u_stride,(GLfloat*)ctlarray,
2553 uorder,type);
2554
2555void
2556gluBeginTrim ( obj )
2557 GLUnurbsObj *obj
2558 CODE:
2559 gluBeginTrim(obj);
2560
2561void
2562gluEndTrim ( obj )
2563 GLUnurbsObj *obj
2564 CODE:
2565 gluEndTrim(obj);
2566
2567void
2568gluPwlCurve ( obj, count, array, stride, type )
2569 GLUnurbsObj *obj
2570 Sint32 count
2571 char *array
2572 Sint32 stride
2573 GLenum type
2574 CODE:
2575 gluPwlCurve(obj,count,(GLfloat*)array,stride,type);
2576
2577AV*
2578gluUnProject ( winx, winy, winz, mm, pm, vp )
2579 double winx
2580 double winy
2581 double winz
2582 char *mm
2583 char *pm
2584 char *vp
2585 CODE:
2586 GLdouble objx, objy, objz;
2587 RETVAL = newAV();
2588 av_push(RETVAL,newSViv(gluUnProject(winx,winy,winz,(GLdouble*)mm,
2589 (GLdouble*)pm,(GLint*)vp,&objx,&objy,&objz)));
2590 av_push(RETVAL,newSVnv((double)objx));
2591 av_push(RETVAL,newSVnv((double)objy));
2592 av_push(RETVAL,newSVnv((double)objz));
2593 OUTPUT:
2594 RETVAL
2595
2596
2597#ifdef GL_VERSION_1_3
2598
2599AV*
2600gluUnProject4 ( winx, winy, winz, clipw, mm, pm, vp, n, f )
2601 double winx
2602 double winy
2603 double winz
2604 double clipw
2605 char *mm
2606 char *pm
2607 char *vp
2608 double n
2609 double f
2610 CODE:
2611 GLdouble objx, objy, objz, objw;
2612 RETVAL = newAV();
2613 av_push(RETVAL,newSViv(gluUnProject4(winx,winy,winz,clipw,(GLdouble*)mm,
2614 (GLdouble*)pm,(GLint*)vp,(GLclampd)n,(GLclampd)f,
2615 &objx,&objy,&objz,&objw)));
2616 av_push(RETVAL,newSVnv((double)objx));
2617 av_push(RETVAL,newSVnv((double)objy));
2618 av_push(RETVAL,newSVnv((double)objz));
2619 av_push(RETVAL,newSVnv((double)objw));
2620 OUTPUT:
2621 RETVAL
2622
2623#endif // GL_VERSION_1_3
2624
2625AV*
2626gluProject ( objx, objy, objz, mm, pm, vp )
2627 double objx
2628 double objy
2629 double objz
2630 char *mm
2631 char *pm
2632 char *vp
2633 CODE:
2634 GLdouble winx, winy, winz;
2635 RETVAL = newAV();
2636 av_push(RETVAL,newSViv(gluUnProject(objx,objy,objz,(GLdouble*)mm,
2637 (GLdouble*)pm,(GLint*)vp,&winx,&winy,&winz)));
2638 av_push(RETVAL,newSVnv((double)winx));
2639 av_push(RETVAL,newSVnv((double)winy));
2640 av_push(RETVAL,newSVnv((double)winz));
2641 OUTPUT:
2642 RETVAL
2643
2644#ifdef GL_VERSION_1_2
2645
2646GLUtesselator*
2647gluNewTess ()
2648 CODE:
2649 RETVAL = gluNewTess();
2650 OUTPUT:
2651 RETVAL
2652
2653void
2654gluTessCallback ( tess, type )
2655 GLUtesselator *tess
2656 GLenum type
2657 CODE:
2658 switch(type) {
2659 case GLU_TESS_BEGIN:
2660 case GLU_TESS_BEGIN_DATA:
2661 gluTessCallback(tess,GLU_TESS_BEGIN_DATA,
2662 (GLvoid*)sdl_perl_tess_begin_callback);
2663 break;
2664
2665 case GLU_TESS_EDGE_FLAG:
2666 case GLU_TESS_EDGE_FLAG_DATA:
2667 gluTessCallback(tess,GLU_TESS_EDGE_FLAG_DATA,
2668 (GLvoid*)sdl_perl_tess_edge_flag_callback);
2669 break;
2670
2671 case GLU_TESS_VERTEX:
2672 case GLU_TESS_VERTEX_DATA:
2673 gluTessCallback(tess,GLU_TESS_VERTEX_DATA,
2674 (GLvoid*)sdl_perl_tess_vertex_callback);
2675 break;
2676
2677 case GLU_TESS_END:
2678 case GLU_TESS_END_DATA:
2679 gluTessCallback(tess,GLU_TESS_END_DATA,
2680 (GLvoid*)sdl_perl_tess_end_callback);
2681 break;
2682
2683 case GLU_TESS_COMBINE:
2684 case GLU_TESS_COMBINE_DATA:
2685 gluTessCallback(tess,GLU_TESS_COMBINE_DATA,
2686 (GLvoid*)sdl_perl_tess_combine_callback);
2687 break;
2688
2689 case GLU_TESS_ERROR:
2690 case GLU_TESS_ERROR_DATA:
2691 gluTessCallback(tess,GLU_TESS_ERROR_DATA,
2692 (GLvoid*)sdl_perl_tess_error_callback);
2693 break;
2694 }
2695
2696void
2697gluTessProperty ( tessobj, property, value )
2698 GLUtesselator *tessobj
2699 Uint32 property
2700 double value
2701 CODE:
2702 gluTessProperty(tessobj,property,value);
2703
2704double
2705gluGetTessProperty ( tessobj, property )
2706 GLUtesselator *tessobj
2707 Uint32 property
2708 CODE:
2709 gluGetTessProperty(tessobj,property,&RETVAL);
2710 OUTPUT:
2711 RETVAL
2712
2713void
2714gluTessNormal ( tessobj, x, y, z )
2715 GLUtesselator *tessobj
2716 double x
2717 double y
2718 double z
2719 CODE:
2720 gluTessNormal(tessobj,x,y,z);
2721
2722void
2723gluTessBeginPolygon ( tessobj, cb )
2724 GLUtesselator *tessobj
2725 SV *cb
2726 CODE:
2727 gluTessBeginPolygon(tessobj,cb);
2728
2729void
2730gluTessEndPolygon ( tessobj )
2731 GLUtesselator *tessobj
2732 CODE:
2733 gluTessEndPolygon(tessobj);
2734
2735void
2736gluTessBeginContour ( tessobj )
2737 GLUtesselator *tessobj
2738 CODE:
2739 gluTessBeginContour(tessobj);
2740
2741void
2742gluTessEndContour ( tessobj )
2743 GLUtesselator *tessobj
2744 CODE:
2745 gluTessEndContour(tessobj);
2746
2747void
2748gluDeleteTess ( tessobj )
2749 GLUtesselator *tessobj
2750 CODE:
2751 gluDeleteTess(tessobj);
2752
2753void
2754gluTessVertex ( tessobj, coords, vd )
2755 GLUtesselator *tessobj
2756 char *coords
2757 char *vd
2758 CODE:
2759 gluTessVertex(tessobj,(GLdouble*)coords,vd);
2760
2761#endif
2762
45f73689 2763GLUquadric *
2764gluNewQuadric ()
2765 CODE:
2766 RETVAL = gluNewQuadric ();
2767 OUTPUT:
2768 RETVAL
2769
2770void
2771gluDeleteQuadric (quad)
2772 GLUquadric *quad
2773
2774void
2775gluQuadricNormals ( quad, normal )
2776 GLUquadric *quad
2777 GLenum normal
2778
2779void
2780gluQuadricTexture ( quad, texture )
2781 GLUquadric *quad
2782 GLboolean texture
2783
2784void
2785gluCylinder ( quad, base, top, height, slices, stacks )
2786 GLUquadric *quad
2787 GLdouble base
2788 GLdouble top
2789 GLdouble height
2790 GLint slices
2791 GLint stacks
2792
2793void
2794gluDisk ( quad, inner, outer, slices, loops )
2795 GLUquadric *quad
2796 GLdouble inner
2797 GLdouble outer
2798 GLint slices
2799 GLint loops
2800
2801void
2802gluPartialDisk ( quad, inner, outer, slices, loops, start, sweep )
2803 GLUquadric *quad
2804 GLdouble inner
2805 GLdouble outer
2806 GLint slices
2807 GLint loops
2808 GLdouble start
2809 GLdouble sweep
2810
2811void
2812gluSphere ( quad, radius, slices, stacks )
2813 GLUquadric *quad
2814 GLdouble radius
2815 GLint slices
2816 GLint stacks
2817
bfd90409 2818#endif
2819