您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ wglShareLists函数代码示例

51自学网 2021-06-03 09:55:49
  C++
这篇教程C++ wglShareLists函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中wglShareLists函数的典型用法代码示例。如果您正苦于以下问题:C++ wglShareLists函数的具体用法?C++ wglShareLists怎么用?C++ wglShareLists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了wglShareLists函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: create

    bool    create(WglDrawable *wglDrawable) {        if (!hglrc) {            HDC hDC = wglDrawable->hDC;            hglrc = wglCreateContext(hDC);            if (!hglrc) {                std::cerr << "error: wglCreateContext failed/n";                exit(1);            }            if (shareContext) {                shareContext->create(wglDrawable);            }            if (!createARB(hDC)) {                if (shareContext) {                    BOOL bRet;                    bRet = wglShareLists(shareContext->hglrc,                                         hglrc);                    if (!bRet) {                        std::cerr                            << "warning: wglShareLists failed: "                            << std::hex << GetLastError() << std::dec                            << "/n";                    }                }            }        }        return true;    }
开发者ID:ShuangxueBai,项目名称:apitrace,代码行数:32,


示例2: wglGetCurrentContext

COffscreenGLContext::COffscreenGLContext(){	//! this creates a 2nd OpenGL context on the >onscreen< window/HDC	//! so don't render to the the default framebuffer (always bind FBOs,DLs,...) !!!	//! get the main (onscreen) GL context	HGLRC mainRC = wglGetCurrentContext();	hdc = wglGetCurrentDC();	if (!hdc || !mainRC) {		throw opengl_error("Couldn't create an offscreen GL context: wglGetCurrentDC failed!");	}	//! create a 2nd GL context	offscreenRC = wglCreateContext(hdc);	if (!offscreenRC) {		throw opengl_error("Couldn't create an offscreen GL context: wglCreateContext failed!");	}	//! share the GL resources (textures,DLists,shaders,...)	if(!wglMakeCurrent(NULL, NULL))		throw opengl_error("Could not deactivate rendering context");	int status = wglShareLists(mainRC, offscreenRC);	if(!wglMakeCurrent(hdc, mainRC))		throw opengl_error("Could not activate rendering context");	if (!status) {		DWORD err = GetLastError();		char msg[256];		SNPRINTF(msg, 255, "Couldn't create an offscreen GL context: wglShareLists failed (error: %i)!", (int)err);		throw opengl_error(msg);	}}
开发者ID:FriedRice,项目名称:spring,代码行数:34,


示例3: ContextSysBase

	Context::Context(Context *shared)		: ContextSysBase()	{		assert( Context::current() == shared );		mTarget = nullptr;		mGLFormat = shared->mGLFormat;		GPU::RenderTargetWin* previousSharedTarget = shared->mTarget;				init();		if ( shared->mGLFormat.versionMajor >= 3 )		{			initNewContext(shared->mHGLRC);		}		else		{			initOldContext();			wglShareLists(shared->mHGLRC, mHGLRC);		}		shared->doneCurrent();		makeCurrent();		{			GLenum wglewInitResult = wglewInit();			GLenum glewInitResult = glewInit();			assert(GLEW_OK == wglewInitResult && GLEW_OK == glewInitResult);		}		doneCurrent();		shared->makeCurrent(previousSharedTarget);	}
开发者ID:AaronMK,项目名称:Meega,代码行数:33,


示例4: SDL_GL_CreateThread

SDL_Thread* SDL_GL_CreateThread(int (*fn)(void *), void *data) {  SDL_SysWMinfo info;  SDL_VERSION(&info.version);  if (SDL_GetWMInfo(&info) == -1) {    // Could not get SDL version info.    return NULL;  }    gl_thread_device = GetDC(info.window);  gl_thread_context = wglCreateContext(gl_thread_device);  if (gl_thread_context == NULL) {    // Could not create new OpenGL context    return NULL;  }    BOOL err = wglShareLists(info.hglrc, gl_thread_context);  if (err == 0) {    int code = GetLastError();    //Could not get OpenGL share lists: %i    return NULL;  }    gl_thread_func = fn;  gl_thread_data = data;    return SDL_CreateThread(gl_thread_create, NULL);}
开发者ID:AntonioCS,项目名称:Corange,代码行数:30,


示例5: makeCurrent

boolmakeCurrent(Drawable *drawable, Context *context){    if (!drawable || !context) {        return wglMakeCurrent(NULL, NULL);    } else {        WglDrawable *wglDrawable = static_cast<WglDrawable *>(drawable);        WglContext *wglContext = static_cast<WglContext *>(context);        if (!wglContext->hglrc) {            wglContext->hglrc = wglCreateContext(wglDrawable->hDC);            if (!wglContext->hglrc) {                std::cerr << "error: wglCreateContext failed/n";                exit(1);                return false;            }            if (wglContext->shareContext) {                BOOL bRet;                bRet = wglShareLists(wglContext->shareContext->hglrc,                                     wglContext->hglrc);                if (!bRet) {                    std::cerr << "warning: wglShareLists failed/n";                }            }        }        return wglMakeCurrent(wglDrawable->hDC, wglContext->hglrc);    }}
开发者ID:mnemo,项目名称:apitrace,代码行数:29,


示例6: WindowedGLContext

    WindowedGLContext (Component* const component_,                       HGLRC contextToShareWith,                       const OpenGLPixelFormat& pixelFormat)        : renderContext (0),          component (component_),          dc (0)    {        initialiseGLExtensions();        jassert (component != nullptr);        createNativeWindow();        PIXELFORMATDESCRIPTOR pfd;        initialisePixelFormatDescriptor (pfd, pixelFormat);        const int format = ChoosePixelFormat (dc, &pfd);        if (format != 0)            SetPixelFormat (dc, format, &pfd);        renderContext = wglCreateContext (dc);        if (renderContext != 0)        {            makeActive();            initialiseGLExtensions();            extensions.initialise();            setPixelFormat (pixelFormat);            if (contextToShareWith != 0)                wglShareLists (contextToShareWith, renderContext);        }    }
开发者ID:rsenn,项目名称:vstsynth,代码行数:32,


示例7: SDL_WM_CreateTempContext

int SDL_WM_CreateTempContext() {    SDL_SysWMinfo info;  SDL_VERSION(&info.version);  if (SDL_GetWMInfo(&info) == -1) {    // Could not get SDL version info.    return 1;  }    temp_device = GetDC(info.window);  temp_context = wglCreateContext(temp_device);  if (temp_context == NULL) {    // Could not create OpenGL context    return 2;  }  if (!wglShareLists(info.hglrc, temp_context)) {    // Could not share lists with temp context.    return 3;  }    return 0;  }
开发者ID:AntonioCS,项目名称:Corange,代码行数:25,


示例8: create_opengl_context

static void create_opengl_context (struct claw_window *window) {	window->device_context = GetDC (window->hwnd);	PIXELFORMATDESCRIPTOR pfd = {		sizeof(PIXELFORMATDESCRIPTOR),		1,		PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_GENERIC_ACCELERATED|PFD_DOUBLEBUFFER,		PFD_TYPE_RGBA,		32,		0, 0, 0, 0, 0, 0, 0, 0,		0, // accumulation buffer		0, 0, 0, 0,		0, // depth buffer		0, // stencil buffer		0, // aux buffers		0, 0, 0, 0, 0	};	int pixel_format = ChoosePixelFormat (window->device_context, &pfd);	SetPixelFormat (window->device_context, pixel_format, &pfd);	window->opengl_context = wglCreateContext (window->device_context);	if (first_context)		wglShareLists (first_context, window->opengl_context);	else		first_context = window->opengl_context;	wglMakeCurrent (window->device_context, window->opengl_context);}
开发者ID:eyelash,项目名称:wing,代码行数:25,


示例9: assignToVideoContext

static intassignToVideoContext(HGLRC hRC){    // Traverse existing Video Contexts to see if we can share gfx resources with any of them    video_contexts_t::iterator it = video_contexts.begin();    int i = 0;	int iempty = -1;    for ( ; it != video_contexts.end(); it ++, i++)     {		if (!it->empty()) {			// Try to share resource lists with first Context in the group			if (wglShareLists(it->front(), hRC) == TRUE) {				// Succeeded, so add the new Rendering Context to this Video Context				it->push_back(hRC);				// We're done, this is the Video Context we were looking for				return 1 + i;			}		}		else if (iempty < 0) {			iempty = i; // remember this Video Context as available		}    }    // Could not share with any Video Context, so create and add new Video Context (or reuse an empty one)	if (iempty < 0) {		video_context_t vctx;		vctx.push_back(hRC);		video_contexts.push_back(vctx);	    return 1 + i; // add 1 to reserve 0 = unassigned	}	else {		video_contexts[iempty].push_back(hRC);		return 1 + iempty;	}}
开发者ID:JPGygax68,项目名称:GSM,代码行数:34,


示例10: createDeviceEx

void CIrrWindow::createIrrDevice(){	// create irr device	SIrrlichtCreationParameters param;	param.WindowId = (void*)getHandle();	param.ZBufferBits = 32;	param.DriverType = video::EDT_OPENGL;		m_device	= createDeviceEx(param);	m_driver	= m_device->getVideoDriver();	m_smgr		= m_device->getSceneManager();		// init opengl	HDC HDc = GetDC( getHandle() );	PIXELFORMATDESCRIPTOR pfd={0};	pfd.nSize=sizeof(PIXELFORMATDESCRIPTOR);	int pf = GetPixelFormat(HDc);		DescribePixelFormat(HDc, pf, sizeof(PIXELFORMATDESCRIPTOR), &pfd);		pfd.dwFlags |= PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW;	pfd.cDepthBits=16;	pf = ChoosePixelFormat(HDc, &pfd);		SetPixelFormat(HDc, pf, &pfd);		// share video data	m_videoData.OpenGLWin32.HWnd = NULL;	m_videoData.OpenGLWin32.HDc = HDc;	m_videoData.OpenGLWin32.HRc = wglCreateContext(HDc);	// share for multithread	wglShareLists((HGLRC)m_driver->getExposedVideoData().OpenGLWin32.HRc, (HGLRC)m_videoData.OpenGLWin32.HRc);		g_irrView = this;	initScene();}
开发者ID:codeman001,项目名称:gsleveleditor,代码行数:34,


示例11: wglCreateContext

HGLRC CL_GL1CreationHelper::create_opengl2_context(HGLRC share_context){	HGLRC opengl2_context = wglCreateContext(hdc);	if (opengl2_context)		wglShareLists(share_context, opengl2_context);	return opengl2_context;}
开发者ID:animehunter,项目名称:clanlib-2.3,代码行数:7,


示例12: Log

void WGLRenderer::init(Device *device, Renderer *other) {	WGLDevice *wglDevice = static_cast<WGLDevice *>(device);	if (m_session == NULL) {		Log(EDebug, "Using an existing WGL context");		m_context = wglGetCurrentContext();		if (m_context == NULL)			Log(EError, "Unable to retrieve the current WGL context!");		m_borrowed = true;	} else {		/* Create a GL context */		Log(EDebug, "Initializing WGL renderer");		m_context = wglCreateContext(wglDevice->getDeviceContext());		if (other != NULL) {			Assert(other->getClass() == m_theClass);			if (wglShareLists(m_context,				static_cast<WGLRenderer *>(other)->m_context) != TRUE)				Log(EError, "Unable to set up context sharing: %s",					lastErrorText().c_str());		}		device->makeCurrent(this);		m_borrowed = false;	}	GLRenderer::init(device);	m_initialized = true;}
开发者ID:blckshrk,项目名称:IFT6042,代码行数:30,


示例13: wglCreateContext

	GLContext* Win32Context::clone() const	{		// Create new context based on own HDC		HGLRC newCtx = wglCreateContext(mHDC);				if (!newCtx)		{			OGRE_EXCEPT(Exception::ERR_INTERNAL_ERROR, 				"Error calling wglCreateContext", "Win32Context::clone");		}		HGLRC oldrc = wglGetCurrentContext();		HDC oldhdc = wglGetCurrentDC();		wglMakeCurrent(NULL, NULL);		// Share lists with old context	    if (!wglShareLists(mGlrc, newCtx))		{			String errorMsg = translateWGLError();			wglDeleteContext(newCtx);			OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR, String("wglShareLists() failed: ") + errorMsg, "Win32Context::clone");		}		// restore old context		wglMakeCurrent(oldhdc, oldrc);				return new Win32Context(mHDC, newCtx);	}
开发者ID:airgames,项目名称:vuforia-gamekit-integration,代码行数:27,


示例14: renderingContext

/// Create a GL rendering context////// @return NULL if failedglContext::renderingContext *glContext::createRenderingContext(){	glContext::renderingContext *rc;	rc = new renderingContext();	rc->_hDC = GetDC(window::getInstance().hWnd());	rc->_hGLRC = wglCreateContext(rc->_hDC);//   HGLRC mainhGLRC = _mainRC ? _mainRC->_hGLRC : 0; //todo for ARB_CREATE_CONTEXT    //rc->_hGLRC = wglCreateContextAttribsARB(rc->_hDC, mainhGLRC, contextAttribs); //TODO for ARB_CREAE_CONTEXT, contextAttribs = NULL if no debug required	if (_mainRC) //main context already created, share withi these contexts		wglShareLists(_mainRC->_hGLRC,rc->_hGLRC);	if(rc->_hGLRC == 0)	{		window::getInstance().messageBoxWithLastError("wglCreateContext");		return false;	}	//TODO debug - makecurrent(rc) to set the debug callbak here   // makeCurrent(rc);    //GLExtensionFunctions::getInstance().resolve();   // if(_options._verbose && GLExtensionFunctions::getInstance()._has_GL_ARB_debug_output) {     //   glDebugMessageCallbackARB(debugMessageCallback, NULL);    //}//    makeUnCurrent();	return rc;}
开发者ID:ArturSoczek,项目名称:OpenGLInsightsCode,代码行数:33,


示例15: glXCreateContext

GLXContextglXCreateContext(Display * display, XVisualInfo * visinfo,  GLXContext share, Bool direct){  /* KLUDGE: GLX really expects a display pointer to be passed     in as the first parameter, but Win32 needs an HDC instead,     so BE SURE that the global XHDC is set before calling this     routine. */  HGLRC context;  context = wglCreateContext(XHDC);#if 0  /* XXX GLUT doesn't support it now, so don't worry about display list     and texture object sharing. */  if (share) {    wglShareLists(share, context);  }#endif  /* Since direct rendering is implicit, the direct flag is     ignored. */  return context;}
开发者ID:LosingLin,项目名称:regal,代码行数:25,


示例16: _gdk_win32_gl_context_impl_new

/*< private >*/GdkGLContextImpl *_gdk_win32_gl_context_impl_new (GdkGLContext  *glcontext,                                GdkGLDrawable *gldrawable,                                GdkGLContext  *share_list,                                gboolean       direct,                                int            render_type){  GdkGLConfig *glconfig;  HDC hdc;  HGLRC hglrc;  GdkGLContextImplWin32 *share_impl = NULL;  GDK_GL_NOTE_FUNC_PRIVATE ();  /*   * Create an OpenGL rendering context.   */  glconfig = gdk_gl_drawable_get_gl_config (gldrawable);  /* Get DC. */  hdc = gdk_win32_gl_window_get_hdc (GDK_GL_WINDOW (gldrawable));  if (hdc == NULL)    return NULL;  GDK_GL_NOTE_FUNC_IMPL ("wglCreateContext");  hglrc = wglCreateContext (hdc);  /* Release DC. */  gdk_win32_gl_window_release_hdc (GDK_GL_WINDOW (gldrawable));  if (hglrc == NULL)    return NULL;  if (share_list != NULL && GDK_IS_GL_CONTEXT (share_list))    {      GDK_GL_NOTE_FUNC_IMPL ("wglShareLists");      share_impl = GDK_GL_CONTEXT_IMPL_WIN32 (share_list);      if (!wglShareLists (share_impl->hglrc, hglrc))        {          wglDeleteContext (hglrc);          return NULL;        }    }  /*   * Instantiate the GdkGLContextImplWin32 object.   */  return gdk_win32_gl_context_impl_new_common (glcontext,                                               glconfig,                                               share_list,                                               render_type,                                               hglrc,                                               FALSE);}
开发者ID:alexmurray,项目名称:gtkglext,代码行数:59,


示例17: WGL_NATIVE

JNIEXPORT jboolean JNICALL WGL_NATIVE(wglShareLists)	(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1){	jboolean rc = 0;	WGL_NATIVE_ENTER(env, that, wglShareLists_FUNC);	rc = (jboolean)wglShareLists((HGLRC)arg0, (HGLRC)arg1);	WGL_NATIVE_EXIT(env, that, wglShareLists_FUNC);	return rc;}
开发者ID:cj-zeiger,项目名称:TicketWatcher,代码行数:9,


示例18: while

bool OglContext::createPBuffer(ms_uint32 width, ms_uint32 height){  HPBUFFERARB hPBuffer = NULL;  hPBufferDC = NULL;  hPBufferRC = NULL;  int pixelFormat;  int valid = false;  UINT numFormats = 0;  float fAttributes[] = {0,0};  int samples = MAX_MULTISAMPLE_SAMPLES;  while ((!valid || numFormats == 0) && samples >= 0) {    int iAttributes[] = {      WGL_SAMPLES_ARB,samples,      WGL_DRAW_TO_PBUFFER_ARB,GL_TRUE,      WGL_SUPPORT_OPENGL_ARB,GL_TRUE,      WGL_ACCELERATION_ARB,WGL_FULL_ACCELERATION_ARB,      WGL_COLOR_BITS_ARB,24,      WGL_ALPHA_BITS_ARB,8,      WGL_DEPTH_BITS_ARB,16,      WGL_STENCIL_BITS_ARB,0,      WGL_SAMPLE_BUFFERS_ARB,GL_TRUE,      WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,      0,0    };    valid = wglChoosePixelFormatARB(window,iAttributes,fAttributes,1,&pixelFormat,&numFormats);    if (!valid || numFormats == 0) samples -= 2;  }  if(numFormats == 0) {    msSetError(MS_OGLERR, "P-buffer Error: Unable to find an acceptable pixel format.", "OglContext::createPBuffer()");    return FALSE;  }  if (!(hPBuffer = wglCreatePbufferARB(window, pixelFormat, width, height, 0))) {    msSetError(MS_OGLERR, "P-buffer Error: Unable to create P-buffer. glError: %d", "OglContext::createPBuffer()", glGetError());    return FALSE;  }  if (!(hPBufferDC = wglGetPbufferDCARB(hPBuffer))) {    msSetError(MS_OGLERR, "P-buffer Error: Unable to get P-buffer DC. glError: %d", "OglContext::createPBuffer()", glGetError());    return FALSE;  }  if (!(hPBufferRC = wglCreateContext(hPBufferDC))) {    msSetError(MS_OGLERR, "P-buffer Error: Unable to get P-buffer DC. glError: %d", "OglContext::createPBuffer()", glGetError());    return FALSE;  }  if (wglShareLists(sharingContext,hPBufferRC) == FALSE) {    msSetError(MS_OGLERR, "P-buffer Error: Unable to share display lists. glError: %d", "OglContext::createPBuffer()", glGetError());    return FALSE;  }  return TRUE;}
开发者ID:AdRiley,项目名称:mapserver,代码行数:56,


示例19: gst_gl_context_wgl_create_context

static gbooleangst_gl_context_wgl_create_context (GstGLContext * context,    GstGLAPI gl_api, GstGLContext * other_context, GError ** error){  GstGLWindow *window;  GstGLContextWGL *context_wgl;  GstGLContextWGL *other_wgl = NULL;  HDC device;  context_wgl = GST_GL_CONTEXT_WGL (context);  window = gst_gl_context_get_window (context);  device = (HDC) gst_gl_window_get_display (window);  if (other_context) {    if (!GST_GL_IS_CONTEXT_WGL (other_context)) {      g_set_error (error, GST_GL_CONTEXT_ERROR,          GST_GL_CONTEXT_ERROR_WRONG_CONFIG,          "Cannot share context with a non-WGL context");      goto failure;    }    other_wgl = (GstGLContextWGL *) other_context;  }  context_wgl->wgl_context = wglCreateContext (device);  if (context_wgl->wgl_context)    GST_DEBUG ("gl context created: %" G_GUINTPTR_FORMAT,        (guintptr) context_wgl->wgl_context);  else {    g_set_error (error, GST_GL_CONTEXT_ERROR,        GST_GL_CONTEXT_ERROR_CREATE_CONTEXT, "failed to create glcontext:0x%x",        (unsigned int) GetLastError ());    goto failure;  }  g_assert (context_wgl->wgl_context);  GST_LOG ("gl context id: %" G_GUINTPTR_FORMAT,      (guintptr) context_wgl->wgl_context);  if (other_wgl) {    if (!wglShareLists (other_wgl->wgl_context, context_wgl->wgl_context)) {      g_set_error (error, GST_GL_CONTEXT_ERROR,          GST_GL_CONTEXT_ERROR_CREATE_CONTEXT, "failed to share contexts 0x%x",          (unsigned int) GetLastError ());      goto failure;    }  }  gst_object_unref (window);  return TRUE;failure:  gst_object_unref (window);  return FALSE;}
开发者ID:ystreet,项目名称:gst-plugins-gl,代码行数:56,


示例20: reset

void PBuffer_GL1_Impl::create(OpenGLWindowProvider &window_provider, const Size &size){	reset();	OpenGL::set_active(gc_provider);	if (glWglCreatePbufferARB == 0)	{		throw Exception("WGL_ARB_pbuffer OpenGL extension not supported by this card");	}	int attribList[1] = { 0 };	PIXELFORMATDESCRIPTOR pfd =	{		sizeof(PIXELFORMATDESCRIPTOR),  // size of this pfd 		1,                              // version number		// PFD_DRAW_TO_WINDOW |            // support window		PFD_SUPPORT_OPENGL //|            // support OpenGL		//PFD_DOUBLEBUFFER |              // double buffered		//PFD_DEPTH_DONTCARE		,             // do you care about a zbuffer?		PFD_TYPE_RGBA,                  // RGBA type		24,                             // 24-bit color depth		0, 0, 0, 0, 0, 0,               // color bits ignored		8,                              // alpha buffer		0,                              // shift bit ignored		0,                              // no accumulation buffer		0, 0, 0, 0,                     // accum bits ignored		0,                              // z-buffer		0,                              // no stencil buffer		0,                              // no auxiliary buffer		PFD_MAIN_PLANE,                 // main layer		0,                              // reserved		0, 0, 0                         // layer masks ignored	};	int pixelformat = ChoosePixelFormat(wglGetCurrentDC(), &pfd);	pbuffer = glWglCreatePbufferARB(		wglGetCurrentDC(),		pixelformat,		size.width,		size.height,		attribList);	pbuffer_dc = glWglGetPbufferDCARB(pbuffer);	pbuffer_context = wglCreateContext(pbuffer_dc);	HGLRC share_context = window_provider.get_share_context();	if (share_context == 0)		throw Exception("Shared OpenGL Context is not valid");	wglShareLists(share_context, pbuffer_context);	pbuffer_size = size;}
开发者ID:Cassie90,项目名称:ClanLib,代码行数:56,


示例21: assert

void *MSWinSurface::createExtraContext(){	assert(hGLRC != 0);	HDC hDC = GetDC(hWnd);	HGLRC hRC = wglCreateContext(hDC);	if (hRC == 0) throw EMSWinError(GetLastError(), "wglCreateContext() (extra context)");    if (! wglShareLists(hGLRC, hRC)) throw EMSWinError(GetLastError(), "wglShareLists() (extra context)");	return hRC;}
开发者ID:JPGygax68,项目名称:GSM,代码行数:10,


示例22: 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,


示例23: wglCreateContext

wxGLContext::wxGLContext(wxGLCanvas *win, const wxGLContext* other){    m_glContext = wglCreateContext(win->GetHDC());    wxCHECK_RET( m_glContext, wxT("Couldn't create OpenGL context") );    if ( other )    {        if ( !wglShareLists(other->m_glContext, m_glContext) )            wxLogLastError(_T("wglShareLists"));    }}
开发者ID:jonntd,项目名称:dynamica,代码行数:11,


示例24: wglGetCurrentDC

int 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: createContext

static inline HGLRC createContext(HDC hdc, HGLRC shared){    HGLRC result = wglCreateContext(hdc);    if (!result) {        qErrnoWarning("%s: wglCreateContext failed.", __FUNCTION__);        return 0;    }    if (shared && !wglShareLists(shared, result))        qErrnoWarning("%s: wglShareLists() failed.", __FUNCTION__);    return result;}
开发者ID:KDE,项目名称:android-qt5-qtbase,代码行数:11,


示例26: _initWndClass

BBGLContext *bbGLGraphicsAttachGraphics( HWND hwnd,int flags ){	BBGLContext *context;		HDC hdc;	HGLRC hglrc;		long pf;	PIXELFORMATDESCRIPTOR pfd;	RECT rect;		_initWndClass();		hdc=GetDC( hwnd );	if( !hdc ) return 0;		_initPfd( &pfd,flags );	int multisample = 0;	if (_MULTISAMPLE2X & flags) multisample = 2;	else if (_MULTISAMPLE4X & flags) multisample = 4;	else if (_MULTISAMPLE8X & flags) multisample = 8;	else if (_MULTISAMPLE16X & flags) multisample = 16;	if (multisample>0){		pf=MyChoosePixelFormat( hdc,flags );	}else{		pf=ChoosePixelFormat( hdc,&pfd );	}	if( !pf ) return 0;	SetPixelFormat( hdc,pf,&pfd );	hglrc=wglCreateContext( hdc );		if( _sharedContext ) wglShareLists( _sharedContext->hglrc,hglrc );		GetClientRect( hwnd,&rect );		context=(BBGLContext*)malloc( sizeof(BBGLContext) );	memset( context,0,sizeof(*context) );		context->mode=MODE_WIDGET;	context->width=rect.right;	context->height=rect.bottom;	context->flags=flags;		context->hdc=hdc;	context->hwnd=hwnd;	context->hglrc=hglrc;		context->succ=_contexts;	_contexts=context;		return context;}
开发者ID:bmx-ng,项目名称:brl.mod,代码行数:52,


示例27: wglGetCurrentDC

void ParticleShaderVoronoi::setupBuffers(int width, int height){	hdc = wglGetCurrentDC();	hglrc = wglGetCurrentContext();	pbufferOne = new nv_pbuffer(width, height, 1);	pbufferOne->wglGetLastError();		// If we're sharing contexts, don't need to share lists	if (pbufferOne->onecontext == false) 		wglShareLists(pbufferOne->hglrc, hglrc);	}
开发者ID:Seashell2011,项目名称:Wickbert,代码行数:14,


示例28: Window

    KT_API WinOGL3Context::WinOGL3Context( Window* window,                                                    WinOGL3Context* sharedWith,                                                    unsigned redBits,                                                    unsigned greenBits,                                                    unsigned blueBits,                                                    unsigned alphaBits,                                                    unsigned depth,                                                    unsigned stencil )    {        myWindow = window ? window : new Window();        myDC = GetDC( myWindow->GetWindowHandle() );        if( !myDC )            kTLaunchException( Exception, "Can't retrieve the DC to create a OGL context" );        PIXELFORMATDESCRIPTOR pfd = {0};        pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);        pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;        pfd.nVersion = 1;        pfd.iPixelType = PFD_TYPE_RGBA;        pfd.iLayerType = PFD_MAIN_PLANE;        pfd.cColorBits = redBits + greenBits + blueBits + alphaBits;        pfd.cRedBits = redBits;        pfd.cGreenBits = greenBits;        pfd.cBlueBits = blueBits;        pfd.cAlphaBits = alphaBits;        pfd.cDepthBits = depth;        pfd.cStencilBits = stencil;        int pixelFormat = ChoosePixelFormat( myDC, &pfd );        if( !pixelFormat )            kTLaunchException( Exception, "Can't find a matching pixel format" );        if( SetPixelFormat( myDC, pixelFormat, &pfd ) == FALSE )            kTLaunchException( Exception, "Can't set the pixel format" );        myOGLContext = wglCreateContext( myDC );        if( !myOGLContext )            kTLaunchException( Exception, "Can't create the context" );        if( sharedWith )        {            if( wglShareLists( sharedWith->GetHandle(), myOGLContext ) == FALSE )                kTLaunchException( Exception, "Can't share the context" );        }    }
开发者ID:Ziple,项目名称:kT,代码行数:50,


示例29: releasePBuffer

//----------------------------------------------------------------------------//void OpenGLWGLPBTextureTarget::initialisePBuffer(){    int creation_attrs[] =    {        WGL_PBUFFER_LARGEST_ARB, true,        0    };    releasePBuffer();    HDC hdc = wglGetCurrentDC();    d_pbuffer = wglCreatePbufferARB(hdc, d_pixfmt,                                     static_cast<int>(d_area.getWidth()),                                    static_cast<int>(d_area.getHeight()),                                    creation_attrs);    if (!d_pbuffer)        CEGUI_THROW(RendererException(            "OpenGLWGLPBTextureTarget::initialisePBuffer - "            "pbuffer creation failure, wglCreatePbufferARB() call failed."));    d_hdc = wglGetPbufferDCARB(d_pbuffer);    if (!d_hdc)        CEGUI_THROW(RendererException(            "OpenGLWGLPBTextureTarget::initialisePBuffer - "            "pbuffer creation failure, wglGetPbufferDCARB() call failed."));    d_context= wglCreateContext(d_hdc);    if (!d_hdc)        CEGUI_THROW(RendererException(            "OpenGLWGLPBTextureTarget::initialisePBuffer - "            "pbuffer creation failure, wglCreateContext() call failed."));    if(!wglShareLists(wglGetCurrentContext(), d_context))        CEGUI_THROW(RendererException(            "OpenGLWGLPBTextureTarget::initialisePBuffer - "            "pbuffer creation failure, wglShareLists() call failed."));    // extract the actual size of the created bufer    int actual_width, actual_height;    wglQueryPbufferARB(d_pbuffer, WGL_PBUFFER_WIDTH_ARB, &actual_width);    wglQueryPbufferARB(d_pbuffer, WGL_PBUFFER_HEIGHT_ARB, &actual_height);    d_area.setSize(Size(static_cast<float>(actual_width),                        static_cast<float>(actual_height)));    // ensure CEGUI::Texture is wrapping real GL texture and has correct size    d_CEGUITexture->setOpenGLTexture(d_texture, d_area.getSize());}
开发者ID:B2O,项目名称:IV-Network,代码行数:51,


示例30: switch

GHOST_TSuccess GHOST_WindowWin32::installDrawingContext(GHOST_TDrawingContextType type){	GHOST_TSuccess success;	switch (type) {	case GHOST_kDrawingContextTypeOpenGL:		{		if(m_stereoVisual)			sPreferredFormat.dwFlags |= PFD_STEREO;		// Attempt to match device context pixel format to the preferred format		int iPixelFormat = EnumPixelFormats(m_hDC);		if (iPixelFormat == 0) {			success = GHOST_kFailure;			break;		}		if (::SetPixelFormat(m_hDC, iPixelFormat, &sPreferredFormat) == FALSE) {			success = GHOST_kFailure;			break;		}		// For debugging only: retrieve the pixel format chosen		PIXELFORMATDESCRIPTOR preferredFormat;		::DescribePixelFormat(m_hDC, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &preferredFormat);		// Create the context		m_hGlRc = ::wglCreateContext(m_hDC);		if (m_hGlRc) {			if (s_firsthGLRc) {				wglShareLists(s_firsthGLRc, m_hGlRc);			} else {				s_firsthGLRc = m_hGlRc;			}			success = ::wglMakeCurrent(m_hDC, m_hGlRc) == TRUE ? GHOST_kSuccess : GHOST_kFailure;		}		else {			success = GHOST_kFailure;		}		}		break;	case GHOST_kDrawingContextTypeNone:		success = GHOST_kSuccess;		break;	default:		success = GHOST_kFailure;	}	return success;}
开发者ID:jinjoh,项目名称:NOOR,代码行数:48,



注:本文中的wglShareLists函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ wglSwapIntervalEXT函数代码示例
C++ wglMakeCurrent函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。