void loadskytexture(char *filebase, texturedata *texti){ char *filebuffer=NULL; int texwid, texht; int errorcode; unsigned char *floortex; trim(filebase); texti->name=0; texti->loaded=0; if(strcmp(filebase,"NULL")==0)return; NewMemory((void **)&filebuffer,strlen(filebase)+1); STRCPY(filebuffer,filebase); glGenTextures(1,&texti->name); glBindTexture(GL_TEXTURE_2D,texti->name); floortex=readpicture(filebuffer,&texwid,&texht,0); if(floortex==NULL){ FREEMEMORY(filebuffer); return; } errorcode=gluBuild2DMipmaps(GL_TEXTURE_2D,4, texwid, texht, GL_RGBA, GL_UNSIGNED_BYTE, floortex); if(errorcode!=0){ FREEMEMORY(floortex); FREEMEMORY(filebuffer); return; } FREEMEMORY(floortex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); #ifdef pp_GPU if(gpuactive==1){ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } else{ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); } #else glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); #endif texti->file=filebuffer; texti->loaded=1; return; }
int canny(int j) { int w, h, i,u; unsigned char yo[522240]; u = 0; if(u==1) { readpicture(yo,j); img.pixel_data = yo; } else { //img.pixel_data = CurrentFrame.framebits; } w = 960; h = 544; img.width = w; img.height = h; img_out.width = 960; img_out.height = 544; unsigned char *img_gauss_data = malloc(w * h * sizeof(char)); img_gauss.pixel_data = img_gauss_data; gaussian_noise_reduce(&img, &img_gauss); //printf("*** performing morphological closing ***\n"); //morph_close(&img, &img_scratch, &img_scratch2, &img_gauss); canny_edge_detect(&img_gauss, &img); write_pgm_image(&img,j); free(img_gauss_data); return(1); }