当前位置: 首页>>代码示例>>C++>>正文


C++ qwglMakeCurrent函数代码示例

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


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

示例1: ResetEvent

void *GLimp_RendererSleep( void ) {
	void    *data;

	if ( !qwglMakeCurrent( glw_state.hDC, NULL ) ) {
		wglErrors++;
	}

	ResetEvent( renderActiveEvent );

	// after this, the front end can exit GLimp_FrontEndSleep
	SetEvent( renderCompletedEvent );

	WaitForSingleObject( renderCommandsEvent, INFINITE );

	if ( !qwglMakeCurrent( glw_state.hDC, glw_state.hGLRC ) ) {
		wglErrors++;
	}

	ResetEvent( renderCompletedEvent );
	ResetEvent( renderCommandsEvent );

	data = smpData;

	// after this, the main thread can exit GLimp_WakeRenderer
	SetEvent( renderActiveEvent );

	return data;
}
开发者ID:Justasic,项目名称:RTCW-MP,代码行数:28,代码来源:win_glimp.c

示例2: GetDC

void idGLWidget::OnPaint()
{

    if (!initialized)
    {
        CDC *dc = GetDC();
        QEW_SetupPixelFormat(dc->m_hDC);
        ReleaseDC(dc);
        initialized = true;
    }
    CPaintDC dc(this); // device context for painting

    CRect rect;
    GetClientRect(rect);

    if (!qwglMakeCurrent(dc.m_hDC, win32.hGLRC))
    {
    }

    qglViewport(0, 0, rect.Width(), rect.Height());
    qglScissor(0, 0, rect.Width(), rect.Height());
    qglMatrixMode(GL_PROJECTION);
    qglLoadIdentity();
    qglClearColor (0.4f, 0.4f, 0.4f, 0.7f);
    qglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);


    qglDisable(GL_DEPTH_TEST);
    qglDisable(GL_BLEND);
    qglOrtho(0, rect.Width(), 0, rect.Height(), -256, 256);

    if (drawable)
    {
        drawable->draw(1, 1, rect.Width()-1, rect.Height()-1);
    }
    else
    {
        qglViewport(0, 0, rect.Width(), rect.Height());
        qglScissor(0, 0, rect.Width(), rect.Height());
        qglMatrixMode(GL_PROJECTION);
        qglLoadIdentity();
        qglClearColor (0.4f, 0.4f, 0.4f, 0.7f);
        qglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    }

    qwglSwapBuffers(dc);
    qglFlush();
    qwglMakeCurrent(win32.hDC, win32.hGLRC);

}
开发者ID:revelator,项目名称:Revelator-Doom3,代码行数:50,代码来源:GLWidget.cpp

示例3: QERApp_Texture_ForName

qtexture_t* WINAPI QERApp_Texture_ForName (const char *name)
{
	// if the texture is not loaded yet, this call will get it loaded
	// but: when we assign a GL bind number, we need to be in the g_qeglobals.d_hdcBase , g_qeglobals.d_hglrcBase GL context
	// the plugin may set the GL context to whatever he likes, but then load would fail
	// NOTE: is context switching time-consuming? then maybe the plugin could handle the context switch and only add a 
	// sanity check in debug mode here
	// read current context
	HDC pluginHDC = qwglGetCurrentDC();
	HGLRC pluginHGLRC = qwglGetCurrentContext();
	qwglMakeCurrent( g_qeglobals.d_hdcBase, g_qeglobals.d_hglrcBase );
	qtexture_t* qtex = Texture_ForName( name );
	return qtex;
	qwglMakeCurrent( pluginHDC, pluginHGLRC );
}
开发者ID:AHPlankton,项目名称:Quake-III-Arena,代码行数:15,代码来源:PlugInManager.cpp

示例4: GLimp_RenderThreadWrapper

/*
===================
GLimp_RenderThreadWrapper
===================
*/
static void GLimp_RenderThreadWrapper()
{
    win32.glimpRenderThread();

    // unbind the context before we die
    qwglMakeCurrent( win32.hDC, NULL );
}
开发者ID:dcahrakos,项目名称:RBDOOM-3-BFG,代码行数:12,代码来源:win_glimp.cpp

示例5: GLimp_ActivateContext

/*
===================
GLimp_ActivateContext
===================
*/
void GLimp_ActivateContext()
{
    if( !qwglMakeCurrent( win32.hDC, win32.hGLRC ) )
    {
        win32.wglErrors++;
    }
}
开发者ID:dcahrakos,项目名称:RBDOOM-3-BFG,代码行数:12,代码来源:win_glimp.cpp

示例6: ResizeWindow

/*
===============
ResizeWindow
===============
*/
static void ResizeWindow( int width, int height ) {
#ifdef WIN32
	int	winWidth, winHeight;
	if ( glConfig.isFullscreen ) {
		winWidth = width;
		winHeight = height;
	} else {
		RECT	r;

		// adjust width and height for window border
		r.bottom = height;
		r.left = 0;
		r.top = 0;
		r.right = width;

		AdjustWindowRect (&r, WINDOW_STYLE|WS_SYSMENU, FALSE);
		winHeight = r.bottom - r.top;
		winWidth = r.right - r.left;

	}
	SetWindowPos( win32.hWnd, HWND_TOP, 0, 0, winWidth, winHeight, SWP_SHOWWINDOW );

	qwglMakeCurrent( win32.hDC, win32.hGLRC );
#endif
}
开发者ID:tankorsmash,项目名称:quadcow,代码行数:30,代码来源:renderbump.cpp

示例7: GLimp_SharedContext_MakeCurrent

/*
** GLimp_SharedContext_MakeCurrent
*/
bool GLimp_SharedContext_MakeCurrent( void *context, void *surface )
{
	if( qwglMakeCurrent && !qwglMakeCurrent( glw_state.hDC, context ) ) {
		return false;
	}
	return true;
}
开发者ID:MGXRace,项目名称:racesow,代码行数:10,代码来源:win_glw.c

示例8: GLimp_SharedContext_MakeCurrent

/*
** GLimp_SharedContext_MakeCurrent
*/
qboolean GLimp_SharedContext_MakeCurrent( void *ctx )
{
	if( qwglMakeCurrent && !qwglMakeCurrent( glw_state.hDC, ctx ) ) {
		return qfalse;
	}
	return qtrue;
}
开发者ID:ewirch,项目名称:qfusion,代码行数:10,代码来源:win_glw.c

示例9: GLW_MakeContext

static int GLW_MakeContext( PIXELFORMATDESCRIPTOR *pPFD )
{
	//
	// don't putz around with pixelformat if it's already set (e.g. this is a soft
	// reset of the graphics system)
	//
	if ( !glw_state.pixelFormatSet )
	{
        int pixelformat;

		//
		// choose, set, and describe our desired pixel format.  If we're
		// using a minidriver then we need to bypass the GDI functions,
		// otherwise use the GDI functions.
		//
		if (glw_state.nPendingPF)
			pixelformat = glw_state.nPendingPF;
		else
		if ( ( pixelformat = GLW_ChoosePFD( glw_state.hDC, pPFD ) ) == 0 )
		{
			ri.Printf( PRINT_ALL, "...GLW_ChoosePFD failed\n");
			return TRY_PFD_FAIL_SOFT;
		}
		ri.Printf( PRINT_DEVELOPER, "...PIXELFORMAT %d selected\n", pixelformat );

		DescribePixelFormat( glw_state.hDC, pixelformat, sizeof( *pPFD ), pPFD );

		if ( SetPixelFormat( glw_state.hDC, pixelformat, pPFD ) == FALSE )
		{
			ri.Printf( PRINT_ALL, "...SetPixelFormat failed\n", glw_state.hDC );
			return TRY_PFD_FAIL_SOFT;
		}

		glw_state.pixelFormatSet = qtrue;
	}

	//
	// startup the OpenGL subsystem by creating a context and making it current
	//
	if ( !glw_state.hGLRC )
	{
		if ( ( glw_state.hGLRC = qwglCreateContext( glw_state.hDC ) ) == 0 )
		{
			ri.Printf( PRINT_ALL, "...GL context creation failure\n" );
			return TRY_PFD_FAIL_HARD;
		}
		ri.Printf( PRINT_DEVELOPER, "...GL context created\n" );

		if ( !qwglMakeCurrent( glw_state.hDC, glw_state.hGLRC ) )
		{
			qwglDeleteContext( glw_state.hGLRC );
			glw_state.hGLRC = NULL;
			ri.Printf( PRINT_ALL, "...GL context creation currency failure\n" );
			return TRY_PFD_FAIL_HARD;
		}
		ri.Printf( PRINT_DEVELOPER, "...GL context creation made current\n" );
	}

	return TRY_PFD_SUCCESS;
}
开发者ID:DaTa-,项目名称:cnq3x,代码行数:60,代码来源:win_glimp.cpp

示例10: GLW_AttemptFSAA

static void GLW_AttemptFSAA()
{
	static const float ar[] = { 0, 0 };
	// ignore r_xyzbits vars - FSAA requires 32-bit color, and anyone using it is implicitly on decent HW
	static int anAttributes[] = {
		WGL_DRAW_TO_WINDOW_ARB, GL_TRUE,
		WGL_SUPPORT_OPENGL_ARB, GL_TRUE,
		WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB,
		WGL_DOUBLE_BUFFER_ARB, GL_TRUE,
		WGL_COLOR_BITS_ARB, 32,
		WGL_ALPHA_BITS_ARB, 0,
		WGL_DEPTH_BITS_ARB, 24,
		WGL_STENCIL_BITS_ARB, 8,
		WGL_SAMPLE_BUFFERS_ARB, GL_TRUE,
		WGL_SAMPLES_ARB, 4,
		0, 0
	};

	qwglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)qwglGetProcAddress( "wglChoosePixelFormatARB" );
	if (!r_ext_multisample->integer || !qwglChoosePixelFormatARB) {
		glDisable(GL_MULTISAMPLE_ARB);
		return;
	}

	int iPFD;
	UINT cPFD;
	anAttributes[19] = r_ext_multisample->integer;	// !!! UGH
	if (!qwglChoosePixelFormatARB(glw_state.hDC, anAttributes, ar, 1, &iPFD, &cPFD) || !cPFD)
		return;

	// now bounce the ENTIRE fucking subsystem thanks to WGL stupidity
	// we can't use GLimp_Shutdown() for this, because that does CDS poking that we don't want
	assert( glw_state.hGLRC && glw_state.hDC && g_wv.hWnd );

	qwglMakeCurrent( glw_state.hDC, NULL );

	if ( glw_state.hGLRC ) {
		qwglDeleteContext( glw_state.hGLRC );
		glw_state.hGLRC = NULL;
	}

	if ( glw_state.hDC ) {
		ReleaseDC( g_wv.hWnd, glw_state.hDC );
		glw_state.hDC = NULL;
	}

	if ( g_wv.hWnd ) {
		DestroyWindow( g_wv.hWnd );
		g_wv.hWnd = NULL;
	}

	ri.Printf( PRINT_ALL, "...enabling FSAA\n" );

	glw_state.nPendingPF = iPFD;
	glw_state.pixelFormatSet = qfalse;
	GLW_CreateWindow( glConfig.vidWidth, glConfig.vidHeight, glConfig.colorBits );
	glw_state.nPendingPF = 0;

	glEnable(GL_MULTISAMPLE_ARB);
}
开发者ID:DaTa-,项目名称:cnq3x,代码行数:60,代码来源:win_glimp.cpp

示例11: GLimp_Shutdown

/*
** GLimp_Shutdown
**
** This routine does all OS specific shutdown procedures for the OpenGL
** subsystem.  Under OpenGL this means NULLing out the current DC and
** HGLRC, deleting the rendering context, and releasing the DC acquired
** for the window.  The state structure is also nulled out.
**
*/
void GLimp_Shutdown( void )
{
    if ( qwglMakeCurrent && !qwglMakeCurrent( NULL, NULL ) )
        Com_Printf ( "GLimp_Shutdown() - wglMakeCurrent failed\n");
    if ( glw_state.hGLRC )
    {
        if (  qwglDeleteContext && !qwglDeleteContext( glw_state.hGLRC ) )
            Com_Printf ( "GLimp_Shutdown() - wglDeleteContext failed\n");
        glw_state.hGLRC = NULL;
    }
    if (glw_state.hDC)
    {
        if ( !ReleaseDC( glw_state.hWnd, glw_state.hDC ) )
            Com_Printf ( "GLimp_Shutdown() - ReleaseDC failed\n" );
        glw_state.hDC   = NULL;
    }
    if (glw_state.hWnd)
    {
        ShowWindow (glw_state.hWnd, SW_HIDE);
        DestroyWindow (	glw_state.hWnd );
        glw_state.hWnd = NULL;
    }

    UnregisterClass (WINDOW_CLASS_NAME, glw_state.hInstance);
    s_classRegistered = false;

    if ( gl_state.fullscreen )
    {
        ChangeDisplaySettings( 0, 0 );
        gl_state.fullscreen = false;
    }
}
开发者ID:q3aql,项目名称:quake2,代码行数:41,代码来源:glw_imp.c

示例12: dc

void CCamWnd::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
  bool bPaint = true;
  if (!qwglMakeCurrent( dc.m_hDC, g_qeglobals.d_hglrcBase ))
  {
    Sys_Printf("ERROR: wglMakeCurrent failed..\n ");
    Sys_Printf("Please restart Q3Radiant if the camera view is not working\n");
  }
  else
  {
    QE_CheckOpenGLForErrors();
    g_pSplitList = NULL;
    if (g_bClipMode)
    {
      if (g_Clip1.Set() && g_Clip2.Set())
      {
        g_pSplitList = ( (g_pParentWnd->ActiveXY()->GetViewType() == XZ) ? !g_bSwitch : g_bSwitch) ? &g_brBackSplits : &g_brFrontSplits;
      }
    }
		Cam_Draw ();
		QE_CheckOpenGLForErrors();
		qwglSwapBuffers(dc.m_hDC);
  }
}
开发者ID:AHPlankton,项目名称:Quake-III-Arena,代码行数:25,代码来源:CamWnd.cpp

示例13: GLimp_FrontEndSleep

void GLimp_FrontEndSleep( void ) {
	
	WaitForSingleObject( renderCompletedEvent, INFINITE );
	if ( !qwglMakeCurrent( glw_state.hDC, glw_state.hGLRC ) ) {
		wglErrors++;
	}
}
开发者ID:DaTa-,项目名称:cnq3x,代码行数:7,代码来源:win_glimp.cpp

示例14: GetWindowRect

void CCamWnd::BenchMark()
{
	PAINTSTRUCT	ps;
  CRect rct;
  GetWindowRect(rct);
  long lStyle = ::GetWindowLong(GetSafeHwnd(), GWL_STYLE);
  ::SetWindowLong(GetSafeHwnd(), GWL_STYLE, QE3_CHILDSTYLE);
  CWnd* pParent = GetParent();
  SetParent(g_pParentWnd);
  MoveWindow(CRect(30, 30, 400, 400), TRUE);

  BeginPaint(&ps);
  if (!qwglMakeCurrent(ps.hdc, g_qeglobals.d_hglrcBase))
		Error ("wglMakeCurrent failed in Benchmark");
  
	qglDrawBuffer (GL_FRONT);
	double dStart = Sys_DoubleTime ();
	for (int i=0 ; i < 100 ; i++)
	{
		m_Camera.angles[YAW] = i*4;
		Cam_Draw();
	}
	qwglSwapBuffers(ps.hdc);
	qglDrawBuffer (GL_BACK);
	double dEnd = Sys_DoubleTime ();
	EndPaint(&ps);
	Sys_Printf ("%5.2f seconds\n", dEnd - dStart);
  ::SetWindowLong(GetSafeHwnd(), GWL_STYLE, lStyle);
  SetParent(pParent);
  MoveWindow(rct, TRUE);
}
开发者ID:AHPlankton,项目名称:Quake-III-Arena,代码行数:31,代码来源:CamWnd.cpp

示例15: GLimp_Shutdown

/*
** GLimp_Shutdown
**
** This routine does all OS specific shutdown procedures for the OpenGL
** subsystem.  Under OpenGL this means NULLing out the current DC and
** HGLRC, deleting the rendering context, and releasing the DC acquired
** for the window.  The state structure is also nulled out.
**
*/
void GLimp_Shutdown( void )
{
	if( glw_state.parenthWnd )
		PostMessage( glw_state.parenthWnd, UWM_APPACTIVE, WA_INACTIVE, 0 );

	if( qwglMakeCurrent && !qwglMakeCurrent( NULL, NULL ) )
		Com_Printf( "ref_gl::R_Shutdown() - wglMakeCurrent failed\n" );
	if( glw_state.hGLRC )
	{
		if( qwglDeleteContext && !qwglDeleteContext( glw_state.hGLRC ) )
			Com_Printf( "ref_gl::R_Shutdown() - wglDeleteContext failed\n" );
		glw_state.hGLRC = NULL;
	}
	if( glw_state.hDC )
	{
		if( !ReleaseDC( glw_state.hWnd, glw_state.hDC ) )
			Com_Printf( "ref_gl::R_Shutdown() - ReleaseDC failed\n" );
		glw_state.hDC   = NULL;
	}
	if( glw_state.hWnd )
	{
		ShowWindow( glw_state.hWnd, SW_HIDE );
		DestroyWindow( glw_state.hWnd );
		glw_state.hWnd = NULL;
	}

	UnregisterClass( WINDOW_CLASS_NAME, glw_state.hInstance );

	if( glState.fullScreen )
	{
		ChangeDisplaySettings( 0, 0 );
		glState.fullScreen = qfalse;
	}
}
开发者ID:Racenet,项目名称:racesow,代码行数:43,代码来源:win_glw.c


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