FreeWRL
view release on metacpan or search on metacpan
OpenGL/OpenGL.xs view on Meta::CPAN
#ifdef SOEIFJSOEIFS_____GL_SGIX_pbuffer
GLXFBConfig *glXChooseFBConfigSGIX(Display *dpy, int screen,
const int *attrib_list, int *nitems)
win = glXCreateGLXPbufferSGIX(Display *dpy,
GLXFBConfig config,
unsigned int *width, unsigned int *height, int attrib_list)
#else
die("NO PBUFFER EXTENSION\n");
#endif
}
/* connect the context to the window */
if(!glXMakeCurrent(dpy, win, cx)) {
fprintf(stderr, "Non current\n");
exit(-1);
}
/* clear the buffer */
glClearColor(0,0,0,1);
}
int
glpXConnectionNumber(d=dpy)
void *d
CODE:
{
Display *dp = d;
RETVAL = ConnectionNumber(dp);
}
OUTPUT:
RETVAL
# If glpOpenWindow was used then glXSwapBuffers should be called
# without parameters (i.e. use the default parameters)
void
glXSwapBuffers(d=dpy,w=win)
void * d
GLXDrawable w
CODE:
{
glXSwapBuffers(d,w);
}
int
XPending(d=dpy)
void * d
CODE:
{
RETVAL = XPending(d);
}
OUTPUT:
RETVAL
void
glpXNextEvent(d=dpy)
void * d
PPCODE:
{
XEvent event;
char buf[10];
KeySym ks;
XNextEvent(d,&event);
switch(event.type) {
case ConfigureNotify:
EXTEND(sp,3);
PUSHs(sv_2mortal(newSViv(event.type)));
PUSHs(sv_2mortal(newSViv(event.xconfigure.width)));
PUSHs(sv_2mortal(newSViv(event.xconfigure.height)));
break;
case KeyPress:
case KeyRelease:
EXTEND(sp,3);
PUSHs(sv_2mortal(newSViv(event.type)));
XLookupString(&event.xkey,buf,sizeof(buf),&ks,0);
buf[0]=(char)ks;buf[1]='\0';
PUSHs(sv_2mortal(newSVpv(buf,1)));
PUSHs(sv_2mortal(newSViv(event.xkey.state)));
break;
case ButtonPress:
case ButtonRelease:
EXTEND(sp,7);
PUSHs(sv_2mortal(newSViv(event.type)));
PUSHs(sv_2mortal(newSViv(event.xbutton.button)));
PUSHs(sv_2mortal(newSViv(event.xbutton.x)));
PUSHs(sv_2mortal(newSViv(event.xbutton.y)));
PUSHs(sv_2mortal(newSViv(event.xbutton.x_root)));
PUSHs(sv_2mortal(newSViv(event.xbutton.y_root)));
PUSHs(sv_2mortal(newSViv(event.xbutton.state)));
break;
case MotionNotify:
EXTEND(sp,4);
PUSHs(sv_2mortal(newSViv(event.type)));
PUSHs(sv_2mortal(newSViv(event.xmotion.state)));
PUSHs(sv_2mortal(newSViv(event.xmotion.x)));
PUSHs(sv_2mortal(newSViv(event.xmotion.y)));
break;
case Expose:
default:
EXTEND(sp,1);
PUSHs(sv_2mortal(newSViv(event.type)));
break;
}
}
void
glpXQueryPointer(d=dpy,w=win)
void * d
GLXDrawable w
PPCODE:
{
int x,y,rx,ry;
Window r,c;
unsigned int m;
XQueryPointer(d,w,&r,&c,&rx,&ry,&x,&y,&m);
EXTEND(sp,3);
PUSHs(sv_2mortal(newSViv(x)));
PUSHs(sv_2mortal(newSViv(y)));
PUSHs(sv_2mortal(newSViv(m)));
}
int
glpRasterFont(name,base,number,d=dpy)
char *name
int base
int number
void *d
CODE:
{
XFontStruct *fi;
int lb;
fi = XLoadQueryFont(d,name);
if(fi == NULL) {
die("No font %s found",name);
}
lb = glGenLists(number);
if(lb == 0) {
die("No display lists left for font %s (need %d)",name,number);
}
glXUseXFont(fi->fid, base, number, lb);
RETVAL=lb;
}
OUTPUT:
RETVAL
void
glpPrintString(base,str)
int base
char *str
CODE:
{
glPushAttrib(GL_LIST_BIT);
glListBase(base);
glCallLists(strlen(str),GL_UNSIGNED_BYTE,(GLubyte*)str);
glPopAttrib();
}
#
# The following XSUBS were done by hand
# These are perl-ized versions of the corresponding opengl function
# The reason is that the API with respect to
# arguments and/or return value differs from the C equivalent
# These functions are more elegant to call and provide better error checking
# than the equivalent counter-part that needs pointer arguments
#
void
glpClipPlane(p,a,b,c,d)
GLenum p
GLdouble a
GLdouble b
GLdouble c
GLdouble d
CODE:
{
GLdouble e[4];
e[0]=a;e[1]=b;e[2]=c;e[3]=d;
glClipPlane(p,e);
}
void
glpGetClipPlane(plane)
GLenum plane
PPCODE:
{
GLdouble equation[4];
glGetClipPlane(plane,equation);
EXTEND(sp,4);
PUSHs(sv_2mortal(newSVnv(equation[0])));
PUSHs(sv_2mortal(newSVnv(equation[1])));
PUSHs(sv_2mortal(newSVnv(equation[2])));
PUSHs(sv_2mortal(newSVnv(equation[3])));
}
void
glpLoadMatrixd(m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,ma,mb,mc,md,me,mf)
GLdouble m0
GLdouble m1
GLdouble m2
GLdouble m3
GLdouble m4
GLdouble m5
GLdouble m6
GLdouble m7
GLdouble m8
GLdouble m9
GLdouble ma
GLdouble mb
GLdouble mc
GLdouble md
GLdouble me
GLdouble mf
CODE:
{
GLdouble m[16];
m[0]= m0; m[1]= m1; m[2]= m2; m[3]= m3;
m[4]= m4; m[5]= m5; m[6]= m6; m[7]= m7;
m[8]= m8; m[9]= m9; m[10]=ma; m[11]=mb;
m[12]=mc; m[13]=md; m[14]=me; m[15]=mf;
glLoadMatrixd(m);
}
void
glpMultMatrixd(m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,ma,mb,mc,md,me,mf)
GLdouble m0
GLdouble m1
GLdouble m2
GLdouble m3
GLdouble m4
GLdouble m5
GLdouble m6
GLdouble m7
GLdouble m8
GLdouble m9
GLdouble ma
GLdouble mb
GLdouble mc
GLdouble md
GLdouble me
GLdouble mf
CODE:
{
GLdouble m[16];
( run in 1.403 second using v1.01-cache-2.11-cpan-5511b514fd6 )