void prep_s2warpstereo(OPTIONS *ioptions) { _s2w_options = ioptions; _s2w_textureready = 0; _s2w_warpingactive = 1; _s2w_warpstereo_txt = -1; _s2w_warpstereo_w = _s2w_warpstereo_h = 0; _s2w_meshfn = NULL; _s2w_meshfn = getenv("S2PLOT_MESHFILE"); if (_s2w_meshfn) { if (!ReadMesh(_s2w_meshfn)) { _s2w_meshfn = NULL; } } if (!_s2w_meshfn) { _s2warn("(internal)", "/S2WPASSV*: no meshfile available"); } _s2debug("(internal)", "/S2WPASSV* device support loaded"); }
void prep_s2fishdome(OPTIONS *ioptions) { _s2fd_options = ioptions; texturetop = NULL; texturebottom = NULL; textureleft = NULL; textureright = NULL; mesh = NULL; meshtype = 0; meshnx = meshny = 0; ndometop = ndomebottom = 0; ndomeleft = ndomeright = 0; dometop = domebottom = NULL; domeleft = domeright = NULL; if (_s2fd_options->dometype == WARPMAP) { // Possibly read the mesh file, for warped dome projection if (!ReadBinMesh(_s2fd_options->meshfile)) { if (_s2fd_options->debug) fprintf(stderr,"Creating default mesh\n"); MakeDefaultMesh(); } } else { //fprintf(stderr, "Making a default mesh of course\n"); MakeDefaultMesh(); } if (_s2fd_options->debug) fprintf(stderr,"Creating the dome\n"); if (!DomeCreate()) { fprintf(stderr,"Failed to create dome geometry\n"); CleanExit(); } // Create the texture buffers and default images if (_s2fd_options->debug) fprintf(stderr,"Creating dome textures\n"); DomeTextures(); // Texture IDs for each face if (_s2fd_options->debug) fprintf(stderr,"Binding textures\n"); glGenTextures(4,walltextureid); if (walltextureid[0] < 1 || walltextureid[1] < 1 || walltextureid[2] < 1 || walltextureid[3] < 1) { fprintf(stderr,"Received bad texture id <%d,%d,%d,%d>\n", (int)walltextureid[0],(int)walltextureid[1],(int)walltextureid[2],(int)walltextureid[3]); } int i; for (i=0;i<4;i++) { if (_s2fd_options->debug) fprintf(stderr,"%d\n",i); glBindTexture(GL_TEXTURE_2D,walltextureid[i]); #if defined(S2CYGWIN) glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP); glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP); #else glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE); #endif glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE); switch (i) { case 0: glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,TEXTURESIZE,TEXTURESIZE,0,GL_RGBA,GL_UNSIGNED_BYTE,texturetop); break; case 1: glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,TEXTURESIZE,TEXTURESIZE,0,GL_RGBA,GL_UNSIGNED_BYTE,texturebottom); break; case 2: glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,TEXTURESIZE,TEXTURESIZE,0,GL_RGBA,GL_UNSIGNED_BYTE,textureleft); break; case 3: glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,TEXTURESIZE,TEXTURESIZE,0,GL_RGBA,GL_UNSIGNED_BYTE,textureright); } } _s2debug("(internal)", "/S2FISH*,/S2TRUNC* device support loaded"); }