这篇教程C++ wglGetCurrentContext函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中wglGetCurrentContext函数的典型用法代码示例。如果您正苦于以下问题:C++ wglGetCurrentContext函数的具体用法?C++ wglGetCurrentContext怎么用?C++ wglGetCurrentContext使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了wglGetCurrentContext函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: SpoutSenderSDK2::~SpoutSenderSDK2(){ // OpenGL context required if(wglGetCurrentContext()) { // ReleaseSender does nothing if there is no sender if(bInitialized) sender.ReleaseSender(); }}
开发者ID:demondias,项目名称:Spout2,代码行数:9,
示例2: DestroyContextvoid DestroyContext (GLContext* ctx){ if (NULL == ctx) return; if (NULL != ctx->rc) wglMakeCurrent(NULL, NULL); if (NULL != ctx->rc) wglDeleteContext(wglGetCurrentContext()); if (NULL != ctx->wnd && NULL != ctx->dc) ReleaseDC(ctx->wnd, ctx->dc); if (NULL != ctx->wnd) DestroyWindow(ctx->wnd); UnregisterClass(L"GLEW", GetModuleHandle(NULL));}
开发者ID:caomw,项目名称:ModelFit,代码行数:9,
示例3: clGetPlatformIDscl_context QHoneycombWidget::CreateContext(){ cl_int errNum; cl_uint numPlatforms; cl_platform_id firstPlatformId; cl_context context = NULL; // First, select an OpenCL platform to run on. For this example, we // simply choose the first available platform. Normally, you would // query for all available platforms and select the most appropriate one. errNum = clGetPlatformIDs(1, &firstPlatformId, &numPlatforms); if (errNum != CL_SUCCESS || numPlatforms <= 0) { std::cerr << "Failed to find any OpenCL platforms." << std::endl; return NULL; } // Next, create an OpenCL context on the platform. Attempt to // create a GPU-based context, and if that fails, try to create // a CPU-based context. cl_context_properties contextProperties[] = {#ifdef _WIN32 CL_CONTEXT_PLATFORM, (cl_context_properties)firstPlatformId, CL_GL_CONTEXT_KHR, (cl_context_properties)wglGetCurrentContext(), CL_WGL_HDC_KHR, (cl_context_properties)wglGetCurrentDC(),#elif defined( __GNUC__) CL_CONTEXT_PLATFORM, (cl_context_properties)clSelectedPlatformID, CL_GL_CONTEXT_KHR, (cl_context_properties)glXGetCurrentContext(), CL_GLX_DISPLAY_KHR, (cl_context_properties)glXGetCurrentDisplay(),#elif defined(__APPLE__) //todo#endif 0 }; context = clCreateContextFromType(contextProperties, CL_DEVICE_TYPE_GPU, NULL, NULL, &errNum); if (errNum != CL_SUCCESS) { std::cout << "Could not create GPU context, trying CPU..." << std::endl; context = clCreateContextFromType(contextProperties, CL_DEVICE_TYPE_CPU, NULL, NULL, &errNum); if (errNum != CL_SUCCESS) { std::cerr << "Failed to create an OpenCL GPU or CPU context." << std::endl; return NULL; } } return context;}
开发者ID:MontanaN,项目名称:HoneycombOpenCL,代码行数:57,
示例4: WGL_NATIVEJNIEXPORT jintLong JNICALL WGL_NATIVE(wglGetCurrentContext) (JNIEnv *env, jclass that){ jintLong rc = 0; WGL_NATIVE_ENTER(env, that, wglGetCurrentContext_FUNC); rc = (jintLong)wglGetCurrentContext(); WGL_NATIVE_EXIT(env, that, wglGetCurrentContext_FUNC); return rc;}
开发者ID:pk-karthik,项目名称:eclipse.platform.swt,代码行数:9,
示例5: ofLog void OpenCL::setupFromOpenGL(int deviceNumber) { ofLog(OF_LOG_VERBOSE, "OpenCL::setupFromOpenGL "); if(isSetup) { ofLog(OF_LOG_VERBOSE, "... already setup. returning"); return; } if(deviceInfo.size() == 0) getDeviceInfos(CL_DEVICE_TYPE_GPU); deviceNumber = (deviceNumber + getNumDevices()) % getNumDevices(); clDevice = deviceInfo[deviceNumber].clDeviceId; cl_platform_id clPlatformID = deviceInfo[deviceNumber].clPlatformId; cl_int err;#ifdef TARGET_OSX CGLContextObj kCGLContext = CGLGetCurrentContext(); CGLShareGroupObj kCGLShareGroup = CGLGetShareGroup(kCGLContext); cl_context_properties properties[] = { CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE, (cl_context_properties)kCGLShareGroup, 0 }; clContext = clCreateContext(properties, 0, 0, NULL, NULL, &err);#elif defined _WIN32 //aqcuire shared context on windows. { // TODO: we want to be more specific about the platform, // at the moment only the first successful platform is selected. cl_context_properties properties[] = { CL_GL_CONTEXT_KHR, (cl_context_properties)wglGetCurrentContext(), CL_WGL_HDC_KHR, (cl_context_properties)wglGetCurrentDC(), CL_CONTEXT_PLATFORM, (cl_context_properties)clPlatformID, 0 }; ofLogNotice() << "Using OpenCL Platform: 0x" << std::hex << clPlatformID; ofLogNotice() << "Using OpenCL Device: 0x" << std::hex << clDevice; clContext = clCreateContext(properties, 1, &clDevice, NULL, NULL, &err); ofLogNotice() << "Created OpenCL context: " << (err == CL_SUCCESS ? "SUCCESS" : "ERROR"); }#endif if(clContext == NULL) { ofLog(OF_LOG_ERROR, "Error creating clContext."); assert(err != CL_INVALID_PLATFORM); assert(err != CL_INVALID_VALUE); assert(err != CL_INVALID_DEVICE); assert(err != CL_INVALID_DEVICE_TYPE); assert(err != CL_DEVICE_NOT_AVAILABLE); assert(err != CL_DEVICE_NOT_FOUND); assert(err != CL_OUT_OF_HOST_MEMORY); assert(false); } createQueue(); }
开发者ID:LeiZou,项目名称:ofxMSAOpenCL,代码行数:56,
示例6: wglGetCurrentContextbool eae6320::OpenGlExtensions::Load( std::string* o_errorMessage ){ // A current OpenGL context must exist before extensions can be loaded { const HGLRC currentContext = wglGetCurrentContext(); if ( currentContext == NULL ) { if ( o_errorMessage ) { *o_errorMessage = "OpenGL extensions can't be loaded without a current OpenGL context"; } return false; } }#define EAE6320_LOADGLFUNCTION( i_functionName, i_functionType ) / i_functionName = reinterpret_cast<i_functionType>( GetGlFunctionAddress( #i_functionName, o_errorMessage ) ); / if ( !i_functionName ) / return false; EAE6320_LOADGLFUNCTION( glActiveTexture, PFNGLACTIVETEXTUREPROC ); EAE6320_LOADGLFUNCTION( glAttachShader, PFNGLATTACHSHADERPROC ); EAE6320_LOADGLFUNCTION( glBindBuffer, PFNGLBINDBUFFERPROC ); EAE6320_LOADGLFUNCTION( glBindVertexArray, PFNGLBINDVERTEXARRAYPROC ); EAE6320_LOADGLFUNCTION( glBufferData, PFNGLBUFFERDATAPROC ); EAE6320_LOADGLFUNCTION( glCompileShader, PFNGLCOMPILESHADERPROC ); EAE6320_LOADGLFUNCTION( glCreateProgram, PFNGLCREATEPROGRAMPROC ); EAE6320_LOADGLFUNCTION( glCreateShader, PFNGLCREATESHADERPROC ); EAE6320_LOADGLFUNCTION( glDeleteBuffers, PFNGLDELETEBUFFERSPROC ); EAE6320_LOADGLFUNCTION( glDeleteProgram, PFNGLDELETEPROGRAMPROC ); EAE6320_LOADGLFUNCTION( glDeleteVertexArrays, PFNGLDELETEVERTEXARRAYSPROC ); EAE6320_LOADGLFUNCTION( glDeleteShader, PFNGLDELETESHADERPROC ); EAE6320_LOADGLFUNCTION( glEnableVertexAttribArray, PFNGLENABLEVERTEXATTRIBARRAYARBPROC ); EAE6320_LOADGLFUNCTION( glGenBuffers, PFNGLGENBUFFERSPROC ); EAE6320_LOADGLFUNCTION( glGenVertexArrays, PFNGLGENVERTEXARRAYSPROC ); EAE6320_LOADGLFUNCTION( glGetProgramInfoLog, PFNGLGETPROGRAMINFOLOGPROC ); EAE6320_LOADGLFUNCTION( glGetProgramiv, PFNGLGETPROGRAMIVPROC ); EAE6320_LOADGLFUNCTION( glGetShaderInfoLog, PFNGLGETSHADERINFOLOGPROC ); EAE6320_LOADGLFUNCTION( glGetShaderiv, PFNGLGETSHADERIVPROC ); EAE6320_LOADGLFUNCTION( glGetUniformLocation, PFNGLGETUNIFORMLOCATIONPROC ); EAE6320_LOADGLFUNCTION( glLinkProgram, PFNGLLINKPROGRAMPROC ); EAE6320_LOADGLFUNCTION( glShaderSource, PFNGLSHADERSOURCEPROC ); EAE6320_LOADGLFUNCTION( glUniform1fv, PFNGLUNIFORM1FVPROC ); EAE6320_LOADGLFUNCTION( glUniform2fv, PFNGLUNIFORM2FVPROC ); EAE6320_LOADGLFUNCTION( glUniform3fv, PFNGLUNIFORM3FVPROC ); EAE6320_LOADGLFUNCTION( glUniform4fv, PFNGLUNIFORM4FVPROC ); EAE6320_LOADGLFUNCTION( glUniformMatrix4fv, PFNGLUNIFORMMATRIX4FVPROC ); EAE6320_LOADGLFUNCTION( glUseProgram, PFNGLUSEPROGRAMPROC ); EAE6320_LOADGLFUNCTION( glVertexAttribPointer, PFNGLVERTEXATTRIBPOINTERPROC ); EAE6320_LOADGLFUNCTION( glCompressedTexImage2D, PFNGLCOMPRESSEDTEXIMAGE2DPROC); EAE6320_LOADGLFUNCTION( glUniform1i, PFNGLUNIFORM1IPROC);#undef EAE6320_LOADGLFUNCTION return true;}
开发者ID:ZardenSawtooth,项目名称:GameEngine,代码行数:56,
示例7: wglGetCurrentContext//----------------------------------------------------------------------------//void OpenGLWGLPBTextureTarget::enablePBuffer() const{ // store old details d_prevContext = wglGetCurrentContext(); d_prevDC = wglGetCurrentDC(); // switch to rendering to the pbuffer if (!wglMakeCurrent(d_hdc, d_context)) std::cerr << "Failed to switch to pbuffer for rendering" << std::endl;}
开发者ID:Toby91,项目名称:DDEngine,代码行数:11,
示例8: bbGLGraphicsSwapSharedContextvoid bbGLGraphicsSwapSharedContext(){ if( wglGetCurrentContext()!=_sharedContext->hglrc ){ wglMakeCurrent( _sharedContext->hdc,_sharedContext->hglrc ); }else if( _currentContext ){ wglMakeCurrent( _currentContext->hdc,_currentContext->hglrc ); }else{ wglMakeCurrent( 0,0 ); }}
开发者ID:bmx-ng,项目名称:brl.mod,代码行数:10,
示例9: glGetStringExtensionManager::ExtensionManager( bool bInitAPI ){ if( !wglGetCurrentContext() ) return; extensions = (char*) glGetString( GL_EXTENSIONS ); if( bInitAPI ) InitAPI();}
开发者ID:Capsup,项目名称:Engine,代码行数:10,
示例10: gs_display_dispose// Destroy the application window. Attempt to remove the rendering context and// the device context as well.void gs_display_dispose(long display){ HWND hwnd = LongToHandle(display); HDC shell = GetDC(hwnd); HGLRC context = wglGetCurrentContext(); wglMakeCurrent(NULL, NULL); wglDeleteContext(context); ReleaseDC(hwnd, shell); DestroyWindow(hwnd);}
开发者ID:skyview059,项目名称:vu,代码行数:12,
示例11: QGLWidgetQtRenderWindow::QtRenderWindow(QWidget* parent, QGLFormat format) : QGLWidget(format, parent){ makeCurrent(); deviceContext = wglGetCurrentDC(); glContext = wglGetCurrentContext(); onMakeCurrent(); mRealtime = false; mNeedsUpdate = true;}
开发者ID:JackMcCallum,项目名称:N-GINE-Old,代码行数:10,
示例12: gleIsOpenGLCurrentconst bool gleIsOpenGLCurrent(){#ifdef WIN32 return wglGetCurrentContext() != NULL;#elif __MACOSX__ #error "Not yet implemented"#else // POSIX return glXGetCurrentContext() != NULL;#endif}
开发者ID:npapier,项目名称:oglpp,代码行数:10,
示例13: IupGLIsCurrentint IupGLIsCurrent (Ihandle* self){ GLData* d = (GLData*)IupGetAttribute(self,"_IUPGL_DATA"); if (d) { if (d->context == wglGetCurrentContext()) return 1; } return 0;}
开发者ID:svn2github,项目名称:iup-iup,代码行数:10,
示例14: wglGetCurrentContextcontext::~context( void ){ if ( _hrc ) { HGLRC oldCtxt = wglGetCurrentContext(); if ( oldCtxt == _hrc ) wglMakeCurrent( _hdc, NULL ); wglDeleteContext( _hrc ); }}
开发者ID:kdt3rd,项目名称:gecko,代码行数:10,
示例15: definedvoid cl_context::init(){ // OpenCL try { // Get available platforms vector<cl::Platform> platforms; cl::Platform::get(&platforms); LOG_INFO<<platforms.front().getInfo<CL_PLATFORM_VERSION>(); // context sharing is OS specific#if defined (__APPLE__) || defined(MACOSX) CGLContextObj curCGLContext = CGLGetCurrentContext(); CGLShareGroupObj curCGLShareGroup = CGLGetShareGroup(curCGLContext); cl_context_properties properties[] = { CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE, (cl_context_properties)curCGLShareGroup, 0 };#elif defined WIN32 cl_context_properties properties[] = { CL_GL_CONTEXT_KHR, (cl_context_properties)wglGetCurrentContext(), CL_WGL_HDC_KHR, (cl_context_properties)wglGetCurrentDC(), CL_CONTEXT_PLATFORM, (cl_context_properties)(platforms[0])(), 0 };#else cl_context_properties properties[] = { CL_GL_CONTEXT_KHR, (cl_context_properties)glXGetCurrentContext(), CL_GLX_DISPLAY_KHR, (cl_context_properties)glXGetCurrentDisplay(), CL_CONTEXT_PLATFORM, (cl_context_properties)(platforms[0])(), 0 };#endif m_context = cl::Context(CL_DEVICE_TYPE_GPU, properties); // Get a list of devices on this platform vector<cl::Device> devices = m_context.getInfo<CL_CONTEXT_DEVICES>(); m_device = devices[0]; // Create a command queue and use the first device m_queue = cl::CommandQueue(m_context, m_device); } catch(cl::Error &error) { LOG_ERROR << error.what() << "(" << oclErrorString(error.err()) << ")"; }}
开发者ID:crocdialer,项目名称:KinskiGL,代码行数:54,
示例16: ARGSARGS(){ //int pdata; HDC hDC; HGLRC gc; THIS_CLASS(); //printf( "DOING USE/n" ); gc = (HGLRC)GET_INT_FIELD("renderContext"); //pdata = (int) GET_INT_FIELD("pData"); if( gc == 0 ) { printf( "gc = 0/n" ); return 0; } hDC = (HDC)GET_INT_FIELD("display"); //printf( "USE - hDC: %d/n", hDC); if( !hDC ) { printf( "use - hdc 0" ); return 0; } if( wglGetCurrentContext() == NULL ) { printf( "ERROR WITH CONTEXT" ); wglMakeCurrent( NULL, NULL ); wglDeleteContext( (HGLRC)GET_INT_FIELD("renderContext") ); SetDCPixelFormat(hDC); // Create palette if needed GetOpenGLPalette(hDC); gc = wglCreateContext( hDC ); wglMakeCurrent( hDC, gc ); SET_INT_FIELD("renderContext", (long)gc ); return 0; } if( !gc ) return 0; if( !wglMakeCurrent( hDC, gc ) ) { wglMakeCurrent( NULL, NULL ); printf( "Error in wglMakeCurrent: %d", GetLastError() ); return 0; } return 1;}
开发者ID:citrit,项目名称:ECSE4750,代码行数:54,
示例17: ChangeDisplaySettingsRenderContextOpenGLWin32::~RenderContextOpenGLWin32() { if (renderContext_) { if (wglGetCurrentContext() == renderContext_) { wglMakeCurrent(NULL, NULL); } wglDeleteContext(renderContext_); } ChangeDisplaySettings(NULL, 0);}
开发者ID:gviau,项目名称:sketch-3d,代码行数:11,
示例18: wglGetCurrentContextbool CGraphicView::GetScreenPtFrom3DPoint( const CPoint3D& modelSpacePt, CPoint& screenPt ){ // this function works for any xyz point but usually we will just be returning the // screen point for a grid point or node. GLint viewport[4]; GLdouble mvMatrix[16], projMatrix[16]; double winX = 0.0; double winY = 0.0; double winZ = 0.0; //depth value between 0 and 1 - for depth sorting bool bSuccess = false; HGLRC currentRC = wglGetCurrentContext(); if( !currentRC ) { TRACE( "CGraphicView::GetScreenPtFrom3DPoint Failed in GetCurrentContext/n" ); return bSuccess; } HDC hDC = wglGetCurrentDC( ); if( !hDC ) { TRACE( "CGraphicView::GetScreenPtFrom3DPoint Failed in GetCurrentDC/n" ); return bSuccess; } //if( !wglMakeCurrent( m_pDC->GetSafeHdc(), m_hDC ) ) if( !wglMakeCurrent( hDC, currentRC ) ) { TRACE( "CGraphicView::GetScreenPtFrom3DPoint Failed in MakeCurrent/n" ); return bSuccess; } glGetIntegerv( GL_VIEWPORT, viewport ); glGetDoublev( GL_MODELVIEW_MATRIX, mvMatrix ); glGetDoublev( GL_PROJECTION_MATRIX, projMatrix ); if( !gluProject( modelSpacePt.x, modelSpacePt.y, modelSpacePt.z, mvMatrix, projMatrix, viewport, &winX, &winY, &winZ ) ) { //TRACE( "Failed in GetScreenPt #2/n" ); //wglMakeCurrent( NULL, NULL ); return bSuccess; } //openGL convention (origin at lower left) screenPt.x = int(winX); screenPt.y = int(winY); //windows convention (origin at upper left) screenPt.y = viewport[3] - viewport[1] - screenPt.y; bSuccess = true; return bSuccess;}
开发者ID:JeffLutzenberger,项目名称:fea-graphics-engine-example,代码行数:54,
示例19: definedvoid CL::TinyCL::selectInteropDevice(DEVICE dev, bool profile) { try { //We assume only the first device and platform will be used //This is after all a lazy implementation cl::Platform::get(&mPlatforms); //Query the devices for the type desired mPlatforms.at(0).getDevices(static_cast<cl_device_type>(dev), &mDevices);#ifdef _WIN32 cl_context_properties properties[] = { CL_GL_CONTEXT_KHR, (cl_context_properties)wglGetCurrentContext(), CL_WGL_HDC_KHR, (cl_context_properties)wglGetCurrentDC(), CL_CONTEXT_PLATFORM, (cl_context_properties)(mPlatforms[0])(), 0 };#elif defined(__linux__) cl_context_properties properties[] = { CL_GL_CONTEXT_KHR, (cl_context_properties)glXGetCurrentContext(), CL_WGL_HDC_KHR, (cl_context_properties)glXGetCurrentDisplay(), CL_CONTEXT_PLATFORM, (cl_context_properties)(mPlatforms[0])(), 0 };#elif defined(__APPLE__) CGLContextObj glContext = CGLGetCurrentContext(); CGLShareGroupObj shareGroup = CGLGetShareGroup(glContext); cl_context_properties properties[] = { CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE, (cl_context_properties)shareGroup, };#endif mContext = cl::Context(mDevices, properties); //Grab the OpenGL device mDevices = mContext.getInfo<CL_CONTEXT_DEVICES>(); if (profile) mQueue = cl::CommandQueue(mContext, mDevices.at(0), CL_QUEUE_PROFILING_ENABLE); else mQueue = cl::CommandQueue(mContext, mDevices.at(0)); std::cout << "OpenCL Info:" << "/nName: " << mDevices.at(0).getInfo<CL_DEVICE_NAME>() << "/nVendor: " << mDevices.at(0).getInfo<CL_DEVICE_VENDOR>() << "/nDriver Version: " << mDevices.at(0).getInfo<CL_DRIVER_VERSION>() << "/nDevice Profile: " << mDevices.at(0).getInfo<CL_DEVICE_PROFILE>() << "/nDevice Version: " << mDevices.at(0).getInfo<CL_DEVICE_VERSION>() << "/nMax Work Group Size: " << mDevices.at(0).getInfo<CL_DEVICE_MAX_WORK_GROUP_SIZE>() << std::endl; } catch (const cl::Error &e) { std::cout << "Error selecting GL interop device: " << e.what() << " code: " << e.err() << std::endl; throw e; }}
开发者ID:Twinklebear,项目名称:OpenCL-OpenGL-Interop,代码行数:54,
示例20: FinitGLvoid COpenGL::FinitGL(){ if (wglGetCurrentContext()) MakeGLContextNotCurrent(); if (m_hGLContext) { wglDeleteContext(m_hGLContext); m_hGLContext = NULL; }}
开发者ID:srdp11,项目名称:particles-in-box,代码行数:11,
示例21: _beginstatic bool _begin(){ //wglMakeCurrent is slow in some environments. so, check if the desired context is already current if(wglGetCurrentContext() == main_hRC) return true; if(!wglMakeCurrent(main_hDC, main_hRC)) return false; return true;}
开发者ID:oupo,项目名称:desmume-oupo-edition,代码行数:11,
示例22: SpoutReceiverSDK2::~SpoutReceiverSDK2(){ // OpenGL context required if(wglGetCurrentContext()) { // ReleaseReceiver does nothing if there is no receiver receiver.ReleaseReceiver(); if(myTexture != 0) glDeleteTextures(1, &myTexture); myTexture = 0; }}
开发者ID:demondias,项目名称:Spout2,代码行数:11,
示例23: GetForegroundWindow// Spout OpenGL initialization functionbool SpoutSenderPlugin::InitOpenGL(){ char windowtitle[512]; // We only need an OpenGL context with no window m_hwnd = GetForegroundWindow(); // Any window will do - we don't render to it if(!m_hwnd) { printf("InitOpenGL error 1/n"); MessageBoxA(NULL, "Error 1/n", "InitOpenGL", MB_OK); return false; } m_hdc = GetDC(m_hwnd); if(!m_hdc) { printf("InitOpenGL error 2/n"); MessageBoxA(NULL, "Error 2/n", "InitOpenGL", MB_OK); return false; } GetWindowTextA(m_hwnd, windowtitle, 256); // debug PIXELFORMATDESCRIPTOR pfd; ZeroMemory( &pfd, sizeof( pfd ) ); pfd.nSize = sizeof( pfd ); pfd.nVersion = 1; pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; pfd.iPixelType = PFD_TYPE_RGBA; pfd.cColorBits = 32; pfd.cDepthBits = 24; // LJ DEBUG - was 16; pfd.cStencilBits = 8; // LJ DEBUG -added pfd.iLayerType = PFD_MAIN_PLANE; int iFormat = ChoosePixelFormat(m_hdc, &pfd); if(!iFormat) { printf("InitOpenGL error 3/n"); MessageBoxA(NULL, "Error 3/n", "InitOpenGL", MB_OK); return false; } if(!SetPixelFormat(m_hdc, iFormat, &pfd)) { printf("InitOpenGL error 4/n"); MessageBoxA(NULL, "Error 4/n", "InitOpenGL", MB_OK); return false; } m_hRC = wglCreateContext(m_hdc); if(!m_hRC) { printf("InitOpenGL error 5/n"); MessageBoxA(NULL, "Error 5/n", "InitOpenGL", MB_OK); return false; } wglMakeCurrent(m_hdc, m_hRC); if(wglGetCurrentContext() == NULL) { printf("InitOpenGL error 6/n"); MessageBoxA(NULL, "Error 6/n", "InitOpenGL", MB_OK); return false; } // Set up a shared context if(!m_hSharedRC) m_hSharedRC = wglCreateContext(m_hdc); if(!m_hSharedRC) { printf("InitOpenGL shared context not created/n"); } if(!wglShareLists(m_hSharedRC, m_hRC)) { printf("wglShareLists failed/n"); } // Drop through to return true /* SendMessageTimeoutA(m_hwnd, WM_GETTEXT, 256, (LPARAM)windowtitle, SMTO_ABORTIFHUNG, 128, NULL); printf("InitOpenGL : hwnd = %x (%s), hdc = %x, context = %x/n", m_hwnd, windowtitle, m_hdc, m_hRC); int nTotalAvailMemoryInKB = 0; int nCurAvailMemoryInKB = 0; // GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048 // GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049 glGetIntegerv(0x9048, &nTotalAvailMemoryInKB); glGetIntegerv(0x9049, &nCurAvailMemoryInKB); printf("Memory : Total [%i], Available [%i]/n", nTotalAvailMemoryInKB, nCurAvailMemoryInKB); */ return true;}
开发者ID:L05,项目名称:Spout2,代码行数:55,
示例24: wglGetCurrentDCint Server::initGLContexts(){ diplayWindow = wglGetCurrentDC(); primaryContext = wglGetCurrentContext(); loadingThreadContext = wglCreateContext(diplayWindow); wglMakeCurrent(NULL, NULL); BOOL error = wglShareLists(primaryContext, loadingThreadContext); wglMakeCurrent(diplayWindow, primaryContext); return 0;}
开发者ID:BSkin,项目名称:Rune,代码行数:11,
示例25: init_ogl_context_exstatic HGLRC init_ogl_context_ex(HDC dc, bool fc, int major, int minor){ HWND testwnd = NULL; HDC testdc = NULL; HGLRC testrc = NULL; HGLRC old_rc = NULL; HDC old_dc = NULL; HGLRC glrc = NULL; testwnd = _al_win_create_hidden_window(); if (!testwnd) return NULL; old_rc = wglGetCurrentContext(); old_dc = wglGetCurrentDC(); testdc = GetDC(testwnd); testrc = init_temp_context(testwnd); if (!testrc) goto bail; if (is_wgl_extension_supported("WGL_ARB_create_context", testdc)) { int attrib[] = {WGL_CONTEXT_MAJOR_VERSION_ARB, major, WGL_CONTEXT_MINOR_VERSION_ARB, minor, WGL_CONTEXT_FLAGS_ARB, 0, 0}; if (fc) attrib[5] = WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; if (!init_context_creation_extensions()) goto bail; /* TODO: we could use the context sharing feature */ glrc = _wglCreateContextAttribsARB(dc, 0, attrib); } else goto bail;bail: wglMakeCurrent(NULL, NULL); if (testrc) { wglDeleteContext(testrc); } wglMakeCurrent(old_dc, old_rc); _wglCreateContextAttribsARB = NULL; if (testwnd) { ReleaseDC(testwnd, testdc); DestroyWindow(testwnd); } return glrc;}
开发者ID:dradtke,项目名称:battlechess,代码行数:53,
示例26: _wgl_releasestatic void_wgl_release (void *abstract_ctx){ cairo_wgl_context_t *ctx = abstract_ctx; if (ctx->prev_dc != wglGetCurrentDC () || ctx->prev_rc != wglGetCurrentContext ()) { wglMakeCurrent (ctx->prev_dc, ctx->prev_rc); }}
开发者ID:GuoCheng111,项目名称:WinCairoRequirements,代码行数:12,
示例27: wglGetCurrentContextCRect CGraphicsCamera::GetViewportRect( ){ GLint viewport[4]; CRect r; HGLRC currentRC = wglGetCurrentContext(); if( currentRC || wglMakeCurrent( m_hDC, m_hGLRC ) ) { glGetIntegerv( GL_VIEWPORT, viewport ); r = CRect( CPoint( viewport[0], viewport[1] ), CPoint( viewport[2], viewport[3] ) ); } return r;}
开发者ID:JeffLutzenberger,项目名称:fea-graphics-engine-example,代码行数:12,
注:本文中的wglGetCurrentContext函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ wglGetCurrentDC函数代码示例 C++ wglDeleteContext函数代码示例 |