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


C++ CreateContext函数代码示例

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


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

示例1: CreateContext

bool AndroidEGL::InitContexts()
{
	bool Result = true; 

	PImplData->SharedContext.eglContext = CreateContext();
	
	PImplData->RenderingContext.eglContext = CreateContext(PImplData->SharedContext.eglContext);
	
	PImplData->SingleThreadedContext.eglContext = CreateContext();
	return Result;
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:11,代码来源:AndroidEGL.cpp

示例2: CreateThread

/**
* Creates a ThreadBlock structure from @func, and its @argument.
* @stacksize is passed to CreateContext call.
**/
static ThreadBlock * CreateThread(void (*func) (void *),void * argument,long stackSize) {

  ucontext_t * linkedContext = CreateContext(ExitRunningThread,NULL,stackSize,0,NULL);
  ucontext_t * threadContext = CreateContext((void (*) (void))func,linkedContext,stackSize,1,argument);
  ThreadBlock * threadBlock = (ThreadBlock *) malloc(sizeof(ThreadBlock));
  threadBlock->context = threadContext;
  threadBlock->status = STATUS_READY;
  threadBlock->numberOfChildren = 0;
  threadBlock->previous = threadBlock->next = threadBlock->parent = NULL;
  threadBlock->id = uThreadContext->currentID++;

  return threadBlock;
}
开发者ID:ParthDesai,项目名称:uthread,代码行数:17,代码来源:uthread.c

示例3: ConnectToSelf

bool ConnectToSelf()
{
    char host[MAX_HOST_LENGTH];
    DWORD length = MAX_HOST_LENGTH;
    MPD_Context *pRightContext, *pLeftContext;

    host[0] = '\0';
    GetComputerName(host, &length);

    // Initialize the new contexts
    pRightContext = CreateContext();
    if (pRightContext == NULL)
	return false;
    strncpy(pRightContext->pszHost, host, MAX_HOST_LENGTH);
    pRightContext->nCurPos = 0;
    pRightContext->nState = MPD_IDLE;
    pRightContext->nLLState = MPD_READING_CMD;
    pRightContext->nType = MPD_RIGHT_SOCKET;

    pLeftContext = CreateContext();
    if (pLeftContext == NULL)
    {
	RemoveContext(pRightContext);
	return false;
    }
    strncpy(pLeftContext->pszHost, host, MAX_HOST_LENGTH);
    pLeftContext->nCurPos = 0;
    pLeftContext->nState = MPD_IDLE;
    pLeftContext->nLLState = MPD_READING_CMD;
    pLeftContext->nType = MPD_LEFT_SOCKET;

    MakeLoopAsync(&pLeftContext->sock, &pRightContext->sock);
    if (pLeftContext->sock == INVALID_SOCKET || pRightContext->sock == INVALID_SOCKET)
    {
	RemoveContext(pLeftContext);
	RemoveContext(pRightContext);
	return false;
    }

    // overwrite the old left and right contexts
    g_pRightContext = pRightContext;
    g_pLeftContext = pLeftContext;
    strncpy(g_pszRightHost, host, MAX_HOST_LENGTH);
    strncpy(g_pszLeftHost, host, MAX_HOST_LENGTH);

    //dbg_printf("ConnectToSelf succeeded\n");
    return true;
}
开发者ID:hpc,项目名称:mvapich-cce,代码行数:48,代码来源:connect_to_self.cpp

示例4: main

int main(int argc, const char *argv[])
{
    KonohaContext* kctx = CreateContext();
    int i;
    void *malloced[100];
    for (i = 0; i < 100; ++i) {
        malloced[i] = PLATAPI GCModule.Kmalloc(0, i, NULL);
    }
    for (i = 0; i < 100; ++i) {
        PLATAPI GCModule.Kfree(0, malloced[i], i);
    }
    for (i = 0; i < 100; ++i) {
        malloced[i] = PLATAPI GCModule.Kzmalloc(0, i, NULL);
        int j;
        char *p = (char *)malloced[i];
        for (j = 0; j < i; ++j) {
            assert(p[0] == 0);
        }
    }
    for (i = 0; i < 100; ++i) {
        PLATAPI GCModule.Kfree(0, malloced[i], i);
    }
    DeleteContext(kctx);
    return 0;
}
开发者ID:masakiishii,项目名称:minikonoha,代码行数:25,代码来源:test_Kmalloc.c

示例5: CreateWindow

HWND OGLWindow::InitInstance(HINSTANCE hInstance, HWND hParent, bool doubleBuf, int x, int y, int w, int h)
{
	// Create the main Window.
	m_hWnd = CreateWindow( 
		m_ClassName,        // name of Window class 
		m_WindowTitle,       // title-bar string 
		WS_BORDER | WS_CHILD/* | WS_CLIPSIBLINGS | WS_CLIPCHILDREN*/, //  
		0,       // default horizontal position 
		0,       // default vertical position 
		1,       // default width 
		1,       // default height 
		hParent,         // no owner Window 
		(HMENU) NULL,        // use class menu 
		hInstance,           // handle to application instance 
		(LPVOID) NULL);      // no Window-creation data 

	if ( !CreateContext() )
	{
		DestroyWindow(m_hWnd);
		m_hWnd = NULL;
	}

	m_width = w;
	m_height = h;

	MoveWindow(m_hWnd, x, y, w, h, FALSE);
	ShowWindow(m_hWnd, SW_HIDE); 

	BOOL makeCurResult = wglMakeCurrent( m_hDC, m_Context );

	return m_hWnd; 
}
开发者ID:Zandriy,项目名称:RedBook8th,代码行数:32,代码来源:OGLWindow.cpp

示例6: locker

void wxGISDisplay::PanningDraw(wxCoord x, wxCoord y, wxDC* pDC)
{
	wxCriticalSectionLocker locker(m_CritSect);

	cairo_set_source_rgb(m_cr_tmp, m_BackGroudnColour.GetRed(), m_BackGroudnColour.GetGreen(), m_BackGroudnColour.GetBlue());
	cairo_paint(m_cr_tmp);

	double dNewX = m_dOrigin_X + double(x);
	double dNewY = m_dOrigin_Y + double(y);
	cairo_set_source_surface (m_cr_tmp, m_saLayerCaches[m_nLastCacheID].pCairoSurface, -dNewX, -dNewY);

	cairo_paint (m_cr_tmp);

	//cairo_surface_t *surface;
    cairo_t *cr;

	cr = CreateContext(pDC);
	//surface = cairo_get_target(cr);

	cairo_set_source_surface (cr, m_surface_tmp, 0, 0);
	cairo_paint (cr);

#ifdef __WXMSW__
    //cairo_surface_destroy (surface);
    cairo_destroy (cr);
#endif
}
开发者ID:GimpoByte,项目名称:nextgismanager,代码行数:27,代码来源:gisdisplay.cpp

示例7: CreateContext

LinuxGLContext::LinuxGLContext(const RenderContextDescriptor& desc, Surface& surface, LinuxGLContext* sharedContext) :
    GLContext { sharedContext }
{
    NativeHandle nativeHandle;
    surface.GetNativeHandle(&nativeHandle);
    CreateContext(desc, nativeHandle, sharedContext);
}
开发者ID:LukasBanana,项目名称:LLGL,代码行数:7,代码来源:LinuxGLContext.cpp

示例8: StartupModule

void FJavascriptEditorModule::StartupModule()
{
#if WITH_EDITOR	
	auto Isolate = NewObject<UJavascriptIsolate>();
	auto Context = Isolate->CreateContext();
	
	JavascriptContext = Context;
	JavascriptContext->AddToRoot();

	JavascriptContext->SetContextId(TEXT("Editor"));

	Tick = NewObject<UJavascriptEditorTick>(JavascriptContext);
	JavascriptContext->Expose(TEXT("Root"), Tick);
	Tick->AddToRoot();

	if (!IsRunningCommandlet())
	{
		FScopedTransaction Transaction(NSLOCTEXT("UnrealEd", "UnrealJS", "Javascript action"));
		FEditorScriptExecutionGuard ScriptGuard;

		Context->RunFile("editor.js");
	}

	bRegistered = true;
	
	FCoreDelegates::OnPreExit.AddRaw(this, &FJavascriptEditorModule::Unregister);
#endif
}
开发者ID:Grinkers,项目名称:Unreal.js,代码行数:28,代码来源:JavascriptEditor.cpp

示例9: GSDXRecoverableError

bool GSWndEGL::Create(const string& title, int w, int h)
{
	if(m_NativeWindow)
		throw GSDXRecoverableError();

	if(w <= 0 || h <= 0) {
		w = theApp.GetConfig("ModeWidth", 640);
		h = theApp.GetConfig("ModeHeight", 480);
	}

	m_managed = true;

	// note this part must be only executed when replaying .gs debug file
	m_NativeDisplay = XOpenDisplay(NULL);
	OpenEGLDisplay();

	m_NativeWindow = XCreateSimpleWindow(m_NativeDisplay, DefaultRootWindow(m_NativeDisplay), 0, 0, w, h, 0, 0, 0);
	XMapWindow (m_NativeDisplay, m_NativeWindow);

	CreateContext(3, 3);

	AttachContext();

	CheckContext();

	PopulateGlFunction();

	if (m_NativeWindow == 0)
		throw GSDXRecoverableError();

	return true;
}
开发者ID:Hourousha,项目名称:pcsx2,代码行数:32,代码来源:GSWndEGL.cpp

示例10: main

int
main(int argc, char *argv[])
{
   GLuint shader = 0;

   ParseOptions(argc, argv);

   if (!CreateContext()) {
      fprintf(stderr, "%s: Failed to create compiler context\n", Prog);
      exit(1);
   }

   if (Options.VertFile) {
      shader = CompileShader(Options.VertFile, GL_VERTEX_SHADER);
   }
   else if (Options.FragFile) {
      shader = CompileShader(Options.FragFile, GL_FRAGMENT_SHADER);
   }

   if (shader) {
      if (Options.OutputFile) {
         fclose(stdout);
         /*stdout =*/ freopen(Options.OutputFile, "w", stdout);
      }
      if (stdout) {
         PrintShaderInstructions(shader, stdout);
      }
      if (Options.OutputFile) {
         fclose(stdout);
      }
   }

   return 0;
}
开发者ID:CPFDSoftware-Tony,项目名称:gmv,代码行数:34,代码来源:glslcompiler.c

示例11: GSDXRecoverableError

bool GSWndOGL::Create(const string& title, int w, int h)
{
	if(m_NativeWindow)
		throw GSDXRecoverableError();

	if(w <= 0 || h <= 0) {
		w = theApp.GetConfig("ModeWidth", 640);
		h = theApp.GetConfig("ModeHeight", 480);
	}

	m_managed = true;

	// note this part must be only executed when replaying .gs debug file
	m_NativeDisplay = XOpenDisplay(NULL);

	m_NativeWindow = XCreateSimpleWindow(m_NativeDisplay, DefaultRootWindow(m_NativeDisplay), 0, 0, w, h, 0, 0, 0);
	XMapWindow (m_NativeDisplay, m_NativeWindow);

	if (m_NativeWindow == 0)
		throw GSDXRecoverableError();

	CreateContext(3, 3);

	AttachContext();

	CheckContext();

	m_swapinterval = (PFNGLXSWAPINTERVALEXTPROC)glXGetProcAddress((const GLubyte*) "glXSwapIntervalEXT");

	PopulateGlFunction();

	return true;
}
开发者ID:jobermayr,项目名称:pcsx2,代码行数:33,代码来源:GSWndOGL.cpp

示例12: main

int main (int argc, char *argv[]) {
    if (InitCVIRTE (0, argv, 0) == 0)
        return -1;    /* out of memory */
    
    if (argc != 2) {
        fprintf(stderr, "you must pass the path to a module to test");
        return -1;
    }
    
    char *testModule = argv[1];
    if (!FileExists(testModule, 0)) {
        fprintf(stderr, "you must pass the path to a module to test");
    }
    
    ListType names;
    SymbolParser *parser = MakeParser(testModule);
    names = GetExports(parser);
    
    context = CreateContext();
    LoadTestInfo info = { .parser = parser, .executeOnContext = context->ExecuteTests };
    ListApplyToEach(names, 1, LoadUserTests, &info);
    
    DeleteParser(parser);
    FreeContext(context);
    return 0;
}
开发者ID:Beerman006,项目名称:cvi-2048,代码行数:26,代码来源:main.c

示例13: myWindow

GlxContext::GlxContext(GlxContext* shared) :
myWindow    (0),
myContext   (NULL),
myOwnsWindow(true)
{
    // Open a connection with the X server
    myDisplay = XOpenDisplay(NULL);

    // Create a dummy window (disabled and hidden)
    int screen = DefaultScreen(myDisplay);
    myWindow = XCreateWindow(myDisplay,
                             RootWindow(myDisplay, screen),
                             0, 0,
                             1, 1,
                             0,
                             DefaultDepth(myDisplay, screen),
                             InputOutput,
                             DefaultVisual(myDisplay, screen),
                             0, NULL);

    // Create the context
    CreateContext(shared, VideoMode::GetDesktopMode().BitsPerPixel, ContextSettings(0, 0, 0));

    // Activate the context
    SetActive(true);
}
开发者ID:vidjogamer,项目名称:ProjectTemplate,代码行数:26,代码来源:GlxContext.cpp

示例14: OpenBlankerWindow

int OpenBlankerWindow( void )
{
	struct NewGadget	ng;
	struct Gadget	*g;
	UWORD		lc, tc;
	UWORD		wleft = BlankerLeft, wtop = BlankerTop, ww, wh;

	ComputeFont( BlankerWidth, BlankerHeight );

	ww = ComputeX( BlankerWidth );
	wh = ComputeY( BlankerHeight );

	if (( wleft + ww + OffX + Scr->WBorRight ) > Scr->Width ) wleft = Scr->Width - ww;
	if (( wtop + wh + OffY + Scr->WBorBottom ) > Scr->Height ) wtop = Scr->Height - wh;

	if ( ! ( BlankerFont = OpenDiskFont( Font )))
		return( 5L );

	if ( ! ( g = CreateContext( &BlankerGList )))
		return( 1L );

	for( lc = 0, tc = 0; lc < Blanker_CNT; lc++ ) {

		CopyMem((char * )&BlankerNGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget ));

		ng.ng_VisualInfo = VisualInfo;
		ng.ng_TextAttr   = Font;
		ng.ng_LeftEdge   = OffX + ComputeX( ng.ng_LeftEdge );
		ng.ng_TopEdge    = OffY + ComputeY( ng.ng_TopEdge );
		ng.ng_Width      = ComputeX( ng.ng_Width );
		ng.ng_Height     = ComputeY( ng.ng_Height);

		BlankerGadgets[ lc ] = g = CreateGadgetA((ULONG)BlankerGTypes[ lc ], g, &ng, ( struct TagItem * )&BlankerGTags[ tc ] );

		while( BlankerGTags[ tc ] ) tc += 2;
		tc++;

		if ( NOT g )
			return( 2L );
	}

	if ( ! ( BlankerWnd = OpenWindowTags( NULL,
				WA_Left,	wleft,
				WA_Top,		wtop,
				WA_Width,	ww + OffX + Scr->WBorRight,
				WA_Height,	wh + OffY + Scr->WBorBottom,
				WA_IDCMP,	BUTTONIDCMP|LISTVIEWIDCMP|IDCMP_MENUPICK|IDCMP_CLOSEWINDOW|IDCMP_VANILLAKEY|IDCMP_REFRESHWINDOW,
				WA_Flags,	WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_SIZEBBOTTOM|WFLG_SMART_REFRESH|WFLG_ACTIVATE|WFLG_RMBTRAP,
				WA_Gadgets,	BlankerGList,
				WA_Title,	BlankerWdt,
				WA_ScreenTitle,	"Garshneblanker",
				WA_PubScreen,	Scr,
				TAG_DONE )))
	return( 4L );

	GT_RefreshWindow( BlankerWnd, NULL );

	return( 0L );
}
开发者ID:samskivert,项目名称:garshneblanker,代码行数:59,代码来源:Garshneblanker.c

示例15: piGetAttr

struct Gadget *CreateAllGadgets(piObject *o)
{
	struct Gadget *g=NULL;
	piObject *go;
	struct Node_Window *nw;

	piGetAttr(o,OBJ_Node,(ULONG *)&nw);

	nw->nw_Gadgets=NULL;
	if(nw->nw_PageGadget==0 && GUI.gui_Mode==MODE_TEST)
	{
		if(nw->nw_MyFlags&MYWA_BBottomSlider)
		{
			g=CreateContext(&nw->nw_Gadgets);
			unless(nw->nw_Object[0]=NewObject(NULL, BUTTONGCLASS,
//				ICA_TARGET, ICTARGET_IDCMP,
				GA_RelVerify,TRUE,
				GA_Image, gui_LeftImage,
				GA_RelRight, 1-(IM_WIDTH(gui_LeftImage)+IM_WIDTH(gui_SizeImage)+IM_WIDTH(gui_RightImage)),
				GA_RelBottom, 1-(IM_HEIGHT(gui_LeftImage)),
				GA_BottomBorder,TRUE,
				GA_Previous,(ULONG *)g,
				(nw->nw_Flags&WFLG_GIMMEZEROZERO) ? GA_GZZGadget : TAG_IGNORE,TRUE,
				GA_ID, GD_LEFTBUTTON,
				TAG_DONE)) return NULL;
			g=(struct Gadget *)nw->nw_Object[0];
			unless(nw->nw_Object[1]=NewObject(NULL, BUTTONGCLASS,
//				ICA_TARGET, ICTARGET_IDCMP,
				GA_RelVerify,TRUE,
				GA_Image, gui_RightImage,
				GA_RelRight, 1-(IM_WIDTH(gui_RightImage)+IM_WIDTH(gui_SizeImage)),
				GA_RelBottom, 1-(IM_HEIGHT(gui_RightImage)),
				GA_BottomBorder,TRUE,
				GA_Previous,(ULONG *)g,
				(nw->nw_Flags&WFLG_GIMMEZEROZERO) ? GA_GZZGadget : TAG_IGNORE,TRUE,
				GA_ID, GD_RIGHTBUTTON,
				TAG_DONE)) return NULL;
			g=(struct Gadget *)nw->nw_Object[1];
			unless(nw->nw_Object[2]=NewObject(NULL, PROPGCLASS,
//				ICA_TARGET, ICTARGET_IDCMP,
				GA_RelVerify,TRUE,
				PGA_Freedom, FREEHORIZ,
				PGA_NewLook, TRUE,
				PGA_Borderless, ((DrawInfo->dri_Flags & DRIF_NEWLOOK) && DrawInfo->dri_Depth != 1),
				GA_Left, 3,
				GA_RelBottom, -(IM_HEIGHT(gui_SizeImage)-3),
				GA_RelWidth, -(4+IM_WIDTH(gui_LeftImage)+IM_WIDTH(gui_RightImage)+IM_WIDTH(gui_SizeImage)+1),
				GA_Height, IM_HEIGHT(gui_SizeImage)-4,
				GA_BottomBorder, TRUE,
				GA_Previous,(ULONG *)g,
				(nw->nw_Flags&WFLG_GIMMEZEROZERO) ? GA_GZZGadget : TAG_IGNORE,TRUE,
				GA_ID, GD_HORIZBUTTON,
				PGA_Total, 1,
				PGA_Visible, 1,
				TAG_DONE)) return NULL;
			g=(struct Gadget *)nw->nw_Object[2];
		}
		else
		{
开发者ID:thom-ek,项目名称:GadToolsBox,代码行数:59,代码来源:gadget.c


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