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

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

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

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

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

示例1: epoxy_conservative_has_wgl_extension

/** * If we can determine the WGL extension support from the current * context, then return that, otherwise give the answer that will just * send us on to get_proc_address(). */boolepoxy_conservative_has_wgl_extension(const char *ext){    HDC hdc = wglGetCurrentDC();    if (!hdc)        return true;    return epoxy_has_wgl_extension(hdc, ext);}
开发者ID:Acidburn0zzz,项目名称:libepoxy,代码行数:15,


示例2: glfntInit

void glfntInit(void){    HDC hdc;    if (LettersDL!=0) return;    hdc=wglGetCurrentDC();    SelectObject(hdc,GetStockObject(SYSTEM_FONT));    LettersDL=glGenLists(128);    wglUseFontBitmaps(hdc,32,127,LettersDL+32);}
开发者ID:FabienPean,项目名称:sofa,代码行数:10,


示例3: SpriteCreate

void SpriteCreate(CCallParams& p){    CBaseOglControl* ctrl = CBaseOglControl::controls[WindowFromDC(wglGetCurrentDC())];    if (0 == ctrl || p.AsString(0) == "" || p.AsString(1) == "")return;    ctrl->Collection().SpriteList().Create(p.AsString(0));    CBaseSprite* spr = GetSprite(p.AsString(0));    if (spr == 0)return;    CBaseTexture* tex = ctrl->Collection().TextureList().Get(p.AsString(1));    spr->SetTexture(tex);}
开发者ID:8441918,项目名称:evg-parser,代码行数:10,


示例4: QGLWidget

QtRenderWindow::QtRenderWindow(QWidget* parent, QGLFormat format) : QGLWidget(format, parent){	makeCurrent();	deviceContext = wglGetCurrentDC();	glContext = wglGetCurrentContext();	onMakeCurrent();	mRealtime = false;	mNeedsUpdate = true;}
开发者ID:JackMcCallum,项目名称:N-GINE-Old,代码行数:10,


示例5: PlatformGetBackbufferDimensions

void PlatformGetBackbufferDimensions( uint32& OutWidth, uint32& OutHeight ){	OutWidth = OutHeight = 0;	HDC DeviceContext = wglGetCurrentDC();	if( DeviceContext )	{		OutWidth = GetDeviceCaps( DeviceContext, HORZRES );		OutHeight = GetDeviceCaps( DeviceContext, VERTRES );	}}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:10,


示例6: wglGetCurrentDC

bool               P3DGLMemoryContextPBuffer::Create                                      (unsigned int        Width,                                       unsigned int        Height,                                       bool                NeedAlpha) {  int              PixelFormat;  UINT             FormatCount;  HDC              CurrDeviceContext;  CurrDeviceContext = wglGetCurrentDC();  if (wglChoosePixelFormatARB( CurrDeviceContext,                               NeedAlpha ? PBufferPixelFormatIntAttrsAlpha :                                           PBufferPixelFormatIntAttrsNoAlpha,                               NULL,                               1,                              &PixelFormat,                              &FormatCount))   {    if (FormatCount == 0)     {      return(false);     }   }  else   {    return(false);   }  PBufferHandle = wglCreatePbufferARB                   (CurrDeviceContext,                    PixelFormat,                     Width,                    Height,                    PBufferAttrs);  if (PBufferHandle == NULL)   {    return(false);   }  PBufferDC = wglGetPbufferDCARB(PBufferHandle);  GLContext = wglCreateContext(PBufferDC);  if (MakeCurrent())   {    return(P3DGLExtInit());   }  else   {    return(false);   }  return(true); }
开发者ID:Benjamin-L,项目名称:Dinosauria,代码行数:55,


示例7: defined

void 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,


示例8: wglGetCurrentContext

bool 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,


示例9: defined

void 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,


示例10: fixCloseWindowOnWin32

//--------------------------------------static void fixCloseWindowOnWin32(){	//get the HWND	handle = WindowFromDC(wglGetCurrentDC());	//store the current message event handler for the window	currentWndProc = (WNDPROC)GetWindowLongPtr(handle, GWL_WNDPROC);	//tell the window to now use our event handler!	SetWindowLongPtr(handle, GWL_WNDPROC, (long)winProc);}
开发者ID:LeoPovoa,项目名称:openFrameworks,代码行数:12,


示例11: wWinMain

//---------------------------------------------------------------------------------int APIENTRY wWinMain(_In_ HINSTANCE hInstance, 	_In_opt_ HINSTANCE hPrevInstance,	_In_ LPWSTR    lpCmdLine, _In_ int       nCmdShow){		int argc = 0;	char* argv = "";	// Exit handler to check memory on exit.	const int result_1 = std::atexit(CheckMemCallback);	std::wstring commandLine(lpCmdLine);	gEditorMode = commandLine.find(L"-Editor") != std::string::npos;	// Setup glut.	glutInit(&argc, &argv);	glutInitWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT);	glutInitWindowPosition(100, 100);	int glutWind = glutCreateWindow(APP_WINDOW_TITLE);		HDC dc = wglGetCurrentDC();	MAIN_WINDOW_HANDLE = WindowFromDC(dc);	glutIdleFunc(Idle);	glutDisplayFunc(Display);       // Register callback handler for window re-paint event		glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_CONTINUE_EXECUTION);	InitGL();                       // Our own OpenGL initialization	// Init sounds system.	CSimpleSound::GetInstance().Initialize(MAIN_WINDOW_HANDLE);		// Call user defined init.	if (gEditorMode)	{		EditorInit();	}	else	{		Init();	}	// Enter glut the event-processing loop					glutMainLoop();		// Call user shutdown.	if (gEditorMode)	{		EditorShutdown();	}	else	{		Shutdown();	}	// Shutdown sound system.	CSimpleSound::GetInstance().Shutdown();	// And we are done.	return 0;}
开发者ID:darren-moore,项目名称:pinball-physics,代码行数:55,


示例12: CreateBufferRegion

HANDLECreateBufferRegion(unsigned int buffers){    /* Create the buffer region. */    HANDLE FBRegion = wglCreateBufferRegionARB(wglGetCurrentDC(), 0, buffers);    if (FBRegion == 0)        puts("wglCreateBufferRegionARB Failed");    return FBRegion;}
开发者ID:mormegil-cz,项目名称:gnubg,代码行数:11,


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


示例14: GetDC

void CBaseOglControl::BaseInitialize(){	parser.Start();	PIXELFORMATDESCRIPTOR pfd;	int pf = 0;	HDC hDC = GetDC(hMy);		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;	pf = ChoosePixelFormat(hDC, &pfd);	if(pf==0)	{		pf = 1;		if(DescribePixelFormat(hDC,pf,sizeof(PIXELFORMATDESCRIPTOR),&pfd)==0)		return;	}	if (SetPixelFormat(hDC, pf, &pfd) == FALSE) return;    hOGL = wglCreateContext(hDC);    	wglMakeCurrent(hDC, hOGL);			quadObj = gluNewQuadric();//Для отрисовки цилиндра, сфер и т.д.		//все перенести в скрипт		glEnable(GL_TEXTURE_2D);		glEnable(GL_LIGHTING);		glEnable(GL_LIGHT0);		glEnable(GL_COLOR_MATERIAL);		//glDisable(GL_CULL_FACE); 		glEnable(GL_DEPTH_TEST);		glEnable(GL_ALPHA_TEST);				glEnable(GL_BLEND); 		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);		glEnable(GL_ALPHA_TEST);		glAlphaFunc(GL_GREATER, 0.5f);				glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);		Initialize();		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);		SwapBuffers(wglGetCurrentDC());		glFlush();			wglMakeCurrent(hDC, 0);}
开发者ID:8441918,项目名称:evg-parser,代码行数:54,


示例15: _SwapBuffers

// The Effects of Double Buffering on Animation Frame Rates//		http://www.futuretech.blinkenlights.nl/dbuffer.htmlbool _SwapBuffers(JSContext *cx, JSObject *obj, unsigned argc, jsval *argv, jsval *rval) {//	glFlush();//	glFinish();//	JL_ASSERT( JL_GetClass(obj) == _class, RT_ERROR_INVALID_CLASS );	HDC hDC = wglGetCurrentDC(); // (TBD) un-specialize from OpenGL	JL_ASSERT( hDC != NULL, "Could not get the Current Device Context." );	BOOL res = SwapBuffers(hDC); // Doc: With multithread applications, flush the drawing commands in any other threads drawing to the same window before calling SwapBuffers.	JL_ASSERT( res, "Unable to SwapBuffers.(%x)", GetLastError() );	return true;}
开发者ID:BenitoJedai,项目名称:jslibs,代码行数:13,


示例16: init_ogl_context_ex

static 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,


示例17: GetClientRect

void CBaseOglCamera::GetViewPort(RECT& vp){	if (viewPort[0] != 0 || viewPort[1] != 0 || viewPort[2] != 0 || viewPort[3] != 0)	{		vp.left = viewPort[0];		vp.top = viewPort[1];		vp.right = viewPort[2];		vp.bottom = viewPort[3];	}	else		GetClientRect(WindowFromDC(wglGetCurrentDC()), &vp);}
开发者ID:8441918,项目名称:evg-parser,代码行数:12,


示例18: wglGetCurrentDC

void RenderTarget_Win32::StartRenderingTo(){	m_hOldDeviceContext = wglGetCurrentDC();	m_hOldRenderContext = wglGetCurrentContext();	BOOL successful = wglMakeCurrent(GraphicsWindow::GetHDC(), g_HGLRC);	ASSERT_M( successful == TRUE, "wglMakeCurrent failed in RenderTarget_Win32::StartRenderingTo()" );	FlushGLErrors();	glBindTexture( GL_TEXTURE_2D, m_texHandle );	AssertNoGLError();}
开发者ID:Highlogic,项目名称:stepmania-event,代码行数:12,


示例19: WGLQueryExtension

/** returns true if the extension is available */static bool WGLQueryExtension(WGLExtensions *extensions, const char *name) {	const GLubyte *extension_string;	if (!extensions->WGL_ARB_extensions_string)		if (!extensions->WGL_EXT_extensions_string)			return false;		else			extension_string = (GLubyte*)extensions->wglGetExtensionsStringEXT();	else		extension_string = (GLubyte*)extensions->wglGetExtensionsStringARB(wglGetCurrentDC());	return extgl_QueryExtension(extension_string, name);}
开发者ID:AlvinNorin,项目名称:Lumen,代码行数:13,


示例20: CreateFontA

void KH::TextDrawer::SelectFont(int size, int charset, const char* face = "Arial") { 	fontName = std::string(face);	fontSize = size;	//创建指定字体 	HFONT hFont = CreateFontA(size, 0, 0, 0, FW_MEDIUM, 0, 0, 0, charset, 							OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, 							DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, face							); 	//把创建的字体选入设备上下文,保存旧字体     	HFONT hOldFont = (HFONT)SelectObject(wglGetCurrentDC(), hFont); }
开发者ID:kinghand,项目名称:KHLexicalAnalysis,代码行数:12,


示例21: fGetExtensionsString

SkWGLExtensions::SkWGLExtensions()    : fGetExtensionsString(nullptr)    , fChoosePixelFormat(nullptr)    , fGetPixelFormatAttribfv(nullptr)    , fGetPixelFormatAttribiv(nullptr)    , fCreateContextAttribs(nullptr)    , fSwapInterval(nullptr)    , fCreatePbuffer(nullptr)    , fGetPbufferDC(nullptr)    , fReleasePbufferDC(nullptr)    , fDestroyPbuffer(nullptr) {    HDC prevDC = wglGetCurrentDC();    HGLRC prevGLRC = wglGetCurrentContext();    PIXELFORMATDESCRIPTOR dummyPFD;    ZeroMemory(&dummyPFD, sizeof(dummyPFD));    dummyPFD.nSize = sizeof(dummyPFD);    dummyPFD.nVersion = 1;    dummyPFD.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;    dummyPFD.iPixelType = PFD_TYPE_RGBA;    dummyPFD.cColorBits  = 32;    dummyPFD.cDepthBits  = 0;    dummyPFD.cStencilBits = 8;    dummyPFD.iLayerType = PFD_MAIN_PLANE;    HWND dummyWND = create_dummy_window();    if (dummyWND) {        HDC dummyDC = GetDC(dummyWND);        int dummyFormat = ChoosePixelFormat(dummyDC, &dummyPFD);        SetPixelFormat(dummyDC, dummyFormat, &dummyPFD);        HGLRC dummyGLRC = wglCreateContext(dummyDC);        SkASSERT(dummyGLRC);        wglMakeCurrent(dummyDC, dummyGLRC);        GET_PROC(GetExtensionsString, ARB);        GET_PROC(ChoosePixelFormat, ARB);        GET_PROC(GetPixelFormatAttribiv, ARB);        GET_PROC(GetPixelFormatAttribfv, ARB);        GET_PROC(CreateContextAttribs, ARB);        GET_PROC(SwapInterval, EXT);        GET_PROC(CreatePbuffer, ARB);        GET_PROC(GetPbufferDC, ARB);        GET_PROC(ReleasePbufferDC, ARB);        GET_PROC(DestroyPbuffer, ARB);        wglMakeCurrent(dummyDC, nullptr);        wglDeleteContext(dummyGLRC);        destroy_dummy_window(dummyWND);    }    wglMakeCurrent(prevDC, prevGLRC);}
开发者ID:03050903,项目名称:skia,代码行数:53,


示例22: btgGLInit

void btgGLInit(CView *pView){	oldRect = drawRect;	pView->GetClientRect(&drawRect);	if(oldRect != drawRect)	{		if (hGLDeviceContext != NULL)		{			wglMakeCurrent(NULL, NULL);			wglDeleteContext(hGLRenderContext);			hGLRenderContext = 0;		}	}	hGLDeviceContext = wglGetCurrentDC();	if (hGLDeviceContext == NULL || hGLRenderContext == 0)	{		hGLDeviceContext = ::GetDC(pView->GetSafeHwnd());		setupPixelFormat(hGLDeviceContext);		setupPalette(hGLDeviceContext);		hGLRenderContext = wglCreateContext(hGLDeviceContext);  //create GL render context and select into window		wglMakeCurrent(hGLDeviceContext, hGLRenderContext);		//create the viewport for rendering		auxInitPosition(0, 0, drawRect.right - drawRect.left, drawRect.bottom - drawRect.top);		//set mode (direct color)		auxInitDisplayMode(AUX_RGB);	}	else	{		//wglMakeCurrent(hGLDeviceContext, hGLRenderContext);	}	CBTGDoc* pDoc = (CBTGDoc*)pView->GetDocument();	glClearColor((GLfloat)pDoc->mBGRed / 255.0f,				 (GLfloat)pDoc->mBGGreen / 255.0f,				 (GLfloat)pDoc->mBGBlue / 255.0f,				 1.0f);	glClear(GL_COLOR_BUFFER_BIT);	glMatrixMode(GL_PROJECTION);	glLoadIdentity();	glMatrixMode(GL_MODELVIEW);	glLoadIdentity();	gluOrtho2D(0, drawRect.right - drawRect.left, 0, drawRect.bottom - drawRect.top);	glDisable(GL_LIGHTING);	glDisable(GL_CULL_FACE);	glDisable(GL_DEPTH_TEST);	glBlendFunc(GL_SRC_ALPHA, GL_ONE);}
开发者ID:Almamu,项目名称:homeworld,代码行数:53,


示例23: _wgl_release

static 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,


示例24: glGenLists

void KH::TextDrawer::DrawEngString(const char* str) {     	static int isFirstCall = 1;     	static GLuint lists;     	if( isFirstCall ) { 		// 如果是第一次调用,执行初始化         		// 为每一个ASCII字符产生一个显示列表         		isFirstCall = 0;         // 申请MAX_CHAR个连续的显示列表编号         		lists = glGenLists(_DRAW_MAX_CHAR);         // 把每个字符的绘制命令都装到对应的显示列表中         		wglUseFontBitmaps(wglGetCurrentDC(), 0, _DRAW_MAX_CHAR, lists);     	}     // 调用每个字符对应的显示列表,绘制每个字符     	for(; *str!='/0'; ++str)        		glCallList(lists + *str);} 
开发者ID:kinghand,项目名称:KHLexicalAnalysis,代码行数:13,


示例25: FsSwapBuffers

void FsSwapBuffers(void){	if(0==doubleBuffer)	{		MessageBoxA(NULL,"Error! FsSwapBuffers used in the single-buffered mode.","Error!",MB_OK);		exit(1);	}	HDC hDC;	glFlush();	hDC=wglGetCurrentDC();	SwapBuffers(hDC);}
开发者ID:nihar1992,项目名称:Ghost-flyer,代码行数:13,


示例26: SetFocus

void CBaseOglControl::ReDraw(){	SetFocus(hMy);	CalcFps();	wglMakeCurrent(GetDC(hMy), hOGL);	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);	Refresh();	SwapBuffers(wglGetCurrentDC());	glFlush();	wglMakeCurrent(GetDC(hMy), 0);}
开发者ID:8441918,项目名称:evg-parser,代码行数:13,


示例27: defined

	MapilVoid GLSprite::DrawString(	SharedPointer < GraphicsFont > pFont,									const MapilTChar* pStr,									ImageTransformationMethod method,									const Vector2 < MapilFloat32 >& v,									MapilUInt32 color )	{		if( !pStr ){			return;		}#if defined ( API_WIN32API )		::HDC hdc = wglGetCurrentDC();		// Build string to be displayed.		MapilTChar str[ 4096 ];		va_list vl;		MapilInt32 len;				va_start( vl, pStr );		len = _vsctprintf( pStr, vl ) + 1;		if( len > sizeof( str ) ){			return;		}		_vstprintf( str, pStr, vl );		va_end( vl );		len = _tcslen( str );		SelectObject( hdc, reinterpret_cast < HFONT > ( pFont->Get() ) );						MapilInt32 list = glGenLists( len );		for( MapilInt32 i = 0; i < len; i++ ){			wglUseFontBitmaps( hdc, str[ i ], 1, list + i );		}		//glDisable( GL_LIGHTING );		glColor4i( ( color >> 16 ) & 0xFF , ( color >> 8 ) & 0xFF, color & 0xFF, ( color >> 24 ) & 0xFF );		//glColor4f( 1.0f, 0.0f, 0.0f, 1.0f );		glRasterPos2f( v.m_X, v.m_Y );		for( MapilInt32 i = 0; i < len; i++ ){			glCallList( list + i );		}		//glEnable( GL_LIGHTING );		glDeleteLists( list, len );#endif	// API_WIN32API	}
开发者ID:nutti,项目名称:MAPIL,代码行数:51,


示例28: prepareSwapOnDC

static void prepareSwapOnDC(HDC hdc,HDC &oldDC,HGLRC &oldRC){  oldDC = wglGetCurrentDC();  oldRC = wglGetCurrentContext();  if(oldDC != hdc)  {    HGLRC rc = rcFromDC[hdc];    if(rc)      Mine_wglMakeCurrent(hdc,rc);    else      printLog("video/opengl: SwapBuffers called on DC with no active rendering context. This is potentially bad./n");  }}
开发者ID:TinkerWorX,项目名称:kkapture,代码行数:14,


示例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: extensionSupportedWGL

static int extensionSupportedWGL(const char* extension){    const char* extensions = NULL;    if (_glfw.wgl.GetExtensionsStringARB)        extensions = _glfw.wgl.GetExtensionsStringARB(wglGetCurrentDC());    else if (_glfw.wgl.GetExtensionsStringEXT)        extensions = _glfw.wgl.GetExtensionsStringEXT();    if (!extensions)        return GLFW_FALSE;    return _glfwStringInExtensionString(extension, extensions);}
开发者ID:GarrPeter,项目名称:glfw,代码行数:14,



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


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