OpenGL
view release on metacpan or search on metacpan
lib/OpenGL/GLX.xs view on Meta::CPAN
}
if (!dpy)
croak("No display!");
RETVAL = dpy;
OUTPUT:
RETVAL
#// glpMoveResizeWindow($x, $y, $width, $height[, $winID[, $display]]);
void
glpMoveResizeWindow(x, y, width, height, w=win, d=dpy)
void* d
GLXDrawable w
int x
int y
unsigned int width
unsigned int height
#// glpMoveWindow($x, $y[, $winID[, $display]]);
void
glpMoveWindow(x, y, w=win, d=dpy)
void* d
GLXDrawable w
int x
int y
#// glpResizeWindow($width, $height[, $winID[, $display]])
void
glpResizeWindow(width, height, w=win, d=dpy)
void* d
GLXDrawable w
unsigned int width
unsigned int height
# If glpOpenWindow was used then glXSwapBuffers should be called
# without parameters (i.e. use the default parameters)
#// glXSwapBuffers([$winID[, $display]])
void
glXSwapBuffers(w=win,d=dpy)
void * d
GLXDrawable w
CODE:
{
glXSwapBuffers(d,w);
}
#// XPending([$display]);
int
XPending(d=dpy)
void * d
CODE:
if (!d) croak("ERROR: called XPending with null X connection");
RETVAL = XPending(d);
OUTPUT:
RETVAL
#// glpXNextEvent([$display]);
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,2);
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)));
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;
}
}
#// glpXQueryPointer([$winID[, $display]]);
void
glpXQueryPointer(w=win,d=dpy)
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)));
}
#endif /* defined HAVE_GLX */
#// glpSetDebug(flag);
void
glpSetDebug(flag)
int flag
CODE:
{
debug = flag;
}
#//# glpReadTex($file);
void
glpReadTex(file)
char * file
CODE:
{
GLsizei w,h;
int d,i;
char buf[250];
unsigned char *image;
FILE *fp;
char *ret;
fp=fopen(file,"r");
if (!fp) croak("couldn't open file %s",file);
ret = fgets(buf,250,fp); /* P3 */
if (buf[0] != 'P' || buf[1] != '3')
croak("Format is not P3 in file %s",file);
ret = fgets(buf,250,fp);
while (buf[0] == '#' && fgets(buf,250,fp)); /* Empty */
if (2 != sscanf(buf,"%d%d",&w,&h))
croak("couldn't read image size from file %s",file);
if (1 != fscanf(fp,"%d",&d))
croak("couldn't read image depth from file %s",file);
if (d != 255)
croak("image depth != 255 in file %s unsupported",file);
if (w>10000 || h>10000)
croak("suspicious size w=%d d=%d in file %s", w, d, file);
New(1431, image, w*h*3, unsigned char);
( run in 0.508 second using v1.01-cache-2.11-cpan-5511b514fd6 )