Acme-MITHALDU-BleedingOpenGL
view release on metacpan or search on metacpan
pogl_gl_top.xs view on Meta::CPAN
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_GLpc */
#// 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);
for(i=0;i<w*h*3;i++) {
int v;
if (1 != fscanf(fp,"%d",&v)) {
Safefree(image);
croak("Error reading number #%d of %d from file %s", i, w*h*3,file);
}
image[i]=(unsigned char) v;
}
fclose(fp);
glTexImage2D(GL_TEXTURE_2D, 0, 3, w,h,
0, GL_RGB, GL_UNSIGNED_BYTE,image);
}
#//# glpHasGLUT();
int
glpHasGLUT()
( run in 2.282 seconds using v1.01-cache-2.11-cpan-98e64b0badf )