本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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
}
示例7: CreateContext
LinuxGLContext::LinuxGLContext(const RenderContextDescriptor& desc, Surface& surface, LinuxGLContext* sharedContext) :
GLContext { sharedContext }
{
NativeHandle nativeHandle;
surface.GetNativeHandle(&nativeHandle);
CreateContext(desc, nativeHandle, sharedContext);
}
示例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
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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 );
}
示例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
{