int OpenGLMakeCurrent(Tcl_Interp* interp, char* name) { Tcl_CmdInfo info; OpenGLClientData* OpenGLPtr; if(!Tcl_GetCommandInfo(interp, name, &info)) return 0; OpenGLPtr=(OpenGLClientData*)info.clientData; #ifndef _WIN32 if (!glXMakeContextCurrent(OpenGLPtr->display, OpenGLPtr->glx_win, OpenGLPtr->glx_win, OpenGLPtr->cx)) { #else if (!wglMakeCurrent(OpenGLPtr->hDC,OpenGLPtr->cx)) { #endif printf("%s failed make current.\n", Tk_PathName(OpenGLPtr->tkwin)); return 0; } return 1; } #define GETCONFIG(attrib, value) \ if(glXGetConfig(OpenGLPtr->display, &vinfo[i], attrib, &value) != 0){\ Tcl_AppendResult(interp, "Error getting attribute: " #attrib, (char *)NULL); \ return TCL_ERROR; \ } #define GETCONFIG_13(attrib, value) \ if(glXGetFBConfigAttrib(OpenGLPtr->display, OpenGLPtr->fb_configs[i], \ attrib, &value) != 0) { \ Tcl_AppendResult(interp, "Error getting attribute: " #attrib,(char *)NULL); \ return TCL_ERROR; \ } static int OpenGLListVisuals(Tcl_Interp *interp, OpenGLClientData *OpenGLPtr) { #ifndef _WIN32 int i; int score=0; char buf[200]; int id, level, db, stereo, r,g,b,a, depth, stencil, ar, ag, ab, aa; //int able; char samples_string[20] = ""; int nvis; XVisualInfo* vinfo=XGetVisualInfo(OpenGLPtr->display, 0, NULL, &nvis); if(!vinfo) { Tcl_AppendResult(interp, "XGetVisualInfo failed", (char *) NULL); return TCL_ERROR; } for(i=0;i<nvis;i++) { id = vinfo[i].visualid; // GETCONFIG(GLX_FBCONFIG_ID, id); GETCONFIG(GLX_LEVEL, level); GETCONFIG(GLX_DOUBLEBUFFER, db); GETCONFIG(GLX_STEREO, stereo); GETCONFIG(GLX_RED_SIZE, r); GETCONFIG(GLX_GREEN_SIZE, g); GETCONFIG(GLX_BLUE_SIZE, b); GETCONFIG(GLX_ALPHA_SIZE, a); GETCONFIG(GLX_DEPTH_SIZE, depth); GETCONFIG(GLX_STENCIL_SIZE, stencil); GETCONFIG(GLX_ACCUM_RED_SIZE, ar); GETCONFIG(GLX_ACCUM_GREEN_SIZE, ag); GETCONFIG(GLX_ACCUM_BLUE_SIZE, ab); GETCONFIG(GLX_ACCUM_ALPHA_SIZE, aa); // GETCONFIG(GLX_RENDER_TYPE, rt); // GETCONFIG(GLX_DRAWABLE_TYPE, dt); //GETCONFIG(GLX_X_RENDERABLE, able); //if (!able) continue; score = db?200:0; score += stereo?1:0; score += r+g+b+a; score += depth*5; sprintf (buf, "{id=%02x, level=%d, %s%srgba=%d:%d:%d:%d, depth=%d," "stencil=%d, accum=%d:%d:%d:%d, %sscore=%d} ", id, level, db?"double, ":"single, ", stereo?"stereo, ":"", r, g, b, a, depth, stencil, ar, ag, ab, aa, samples_string, score); Tcl_AppendResult(interp, buf, (char *)NULL); } #else // _WIN32 // I am using the *PixelFormat commands from win32 because according // to the Windows page, we should prefer this to wgl*PixelFormatARB. // Unfortunately, this means that the Windows code will differ // substantially from that of other platforms. However, it has the // advantage that we don't have to use the wglGetProc to get // the procedure address, or test to see if the applicable extension // is supported. WM:VI int id, level, db, stereo, r,g,b,a, depth, stencil, ar, ag, ab, aa; int score=0; char buf[200]; char samples_string[20] = ""; int iPixelFormat = GetPixelFormat(OpenGLPtr->hDC); PIXELFORMATDESCRIPTOR pfd; DescribePixelFormat(OpenGLPtr->hDC,iPixelFormat,sizeof(pfd),&pfd); // I am assuming for the sake of simplicity that overlays are not being used. // If that is not the case, then we will need to change this. /* for(i=0;i<nvis;i++) */ /* { */ // id = vinfo[i].visualid; // GETCONFIG(GLX_FBCONFIG_ID, id); // GETCONFIG(GLX_LEVEL, level); id = 0; level = 0; db = ((pfd.dwFlags & PFD_DOUBLEBUFFER) == PFD_DOUBLEBUFFER); stereo = ((pfd.dwFlags & PFD_STEREO) == PFD_STEREO); r = pfd.cRedBits; g = pfd.cGreenBits; b = pfd.cBlueBits; a = pfd.cAlphaBits; depth = pfd.cDepthBits; stencil = pfd.cStencilBits; ar = pfd.cAccumRedBits; ag = pfd.cAccumGreenBits; ab = pfd.cAccumBlueBits; aa = pfd.cAccumAlphaBits; // GETCONFIG(GLX_RENDER_TYPE, rt); // GETCONFIG(GLX_DRAWABLE_TYPE, dt); //GETCONFIG(GLX_X_RENDERABLE, able); //if (!able) continue; score = db?200:0; score += stereo?1:0; score += r+g+b+a; score += depth*5; sprintf (buf, "{id=%02x, level=%d, %s%srgba=%d:%d:%d:%d, depth=%d," "stencil=%d, accum=%d:%d:%d:%d, %sscore=%d} ", id, level, db?"double, ":"single, ", stereo?"stereo, ":"", r, g, b, a, depth, stencil, ar, ag, ab, aa, samples_string, score); Tcl_AppendResult(interp, buf, (char *)NULL); /* } */ #endif return TCL_OK; };
return hr; } void CModuleConfiguration::CleanupStoredContext() { delete this; } #define GETCONFIG(prop) \ CModuleConfiguration* c; \ GetConfig(ctx, &c); \ return c->prop; DWORD CModuleConfiguration::GetMaxPendingRequestsPerApplication(IHttpContext* ctx) { GETCONFIG(maxPendingRequestsPerApplication) } DWORD CModuleConfiguration::GetAsyncCompletionThreadCount(IHttpContext* ctx) { GETCONFIG(asyncCompletionThreadCount) } DWORD CModuleConfiguration::GetMaxProcessCountPerApplication(IHttpContext* ctx) { GETCONFIG(maxProcessCountPerApplication) } LPCTSTR CModuleConfiguration::GetNodeProcessCommandLine(IHttpContext* ctx) { GETCONFIG(nodeProcessCommandLine)
static int route_del(struct main_server_st* s, proc_st *proc, const char* route, const char* dev) { return route_adddel(s, proc, GETCONFIG(s)->route_del_cmd, route, dev); }