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


C++ GetCurrentContext函数代码示例

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


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

示例1: DECLEXPORT

DECLEXPORT(void) STATE_APIENTRY crStateUseProgram(GLuint program)
{
    CRContext *g = GetCurrentContext();

    if (program>0)
    {
        CRGLSLProgram *pProgram = crStateGetProgramObj(program);

        if (!pProgram)
        {
            crWarning("Unknown program %d", program);
            return;
        }

        g->glsl.activeProgram = pProgram;
    }
    else
    {
        g->glsl.activeProgram = NULL;
    }
}
开发者ID:druidsbane,项目名称:VirtualMonitor,代码行数:21,代码来源:state_glsl.c

示例2: PlatformOpenGLCurrentContext

EOpenGLCurrentContext PlatformOpenGLCurrentContext(FPlatformOpenGLDevice* Device)
{
	HGLRC Context = GetCurrentContext();

	if (Context == Device->RenderingContext.OpenGLContext)	// most common case
	{
		return CONTEXT_Rendering;
	}
	else if (Context == Device->SharedContext.OpenGLContext)
	{
		return CONTEXT_Shared;
	}
	else if (Context)
	{
		return CONTEXT_Other;
	}
	else
	{
		return CONTEXT_Invalid;
	}
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:21,代码来源:OpenGLWindows.cpp

示例3: crStateIsBufferBound

GLboolean crStateIsBufferBound(GLenum target)
{
    CRContext *g = GetCurrentContext();
    CRBufferObjectState *b = &(g->bufferobject);

    switch (target)
    {
        case GL_ARRAY_BUFFER_ARB:
            return b->arrayBuffer->id!=0;
        case GL_ELEMENT_ARRAY_BUFFER_ARB:
            return b->elementsBuffer->id!=0;
#ifdef CR_ARB_pixel_buffer_object
        case GL_PIXEL_PACK_BUFFER_ARB:
            return b->packBuffer->id!=0;
        case GL_PIXEL_UNPACK_BUFFER_ARB:
            return b->unpackBuffer->id!=0;
#endif
        default:
            return GL_FALSE;
    }
}
开发者ID:LastRitter,项目名称:vbox-haiku,代码行数:21,代码来源:state_bufferobject.c

示例4: crStateSetCurrent

/*
 * As above, but don't call crStateSwitchContext().
 */
void crStateSetCurrent( CRContext *ctx )
{
    CRContext *current = GetCurrentContext();

    if (ctx == NULL)
        ctx = defaultContext;

    if (current == ctx)
        return; /* no-op */

    CRASSERT(ctx);

#ifdef CHROMIUM_THREADSAFE
    SetCurrentContext(ctx);
#else
    __currentContext = ctx;
#endif

    /* ensure matrix state is also current */
    crStateMatrixMode(ctx->transform.matrixMode);
}
开发者ID:quiquetux,项目名称:jokte-ba-as,代码行数:24,代码来源:state_init.c

示例5: DECLEXPORT

DECLEXPORT(void) STATE_APIENTRY
crStateBindRenderbufferEXT(GLenum target, GLuint renderbuffer)
{
    CRContext *g = GetCurrentContext();
    CRFramebufferObjectState *fbo = &g->framebufferobject;

    CRSTATE_CHECKERR(g->current.inBeginEnd, GL_INVALID_OPERATION, "called in begin/end");
    CRSTATE_CHECKERR(target!=GL_RENDERBUFFER_EXT, GL_INVALID_ENUM, "invalid target");

    if (renderbuffer)
    {
        fbo->renderbuffer = (CRRenderbufferObject*) crHashtableSearch(g->shared->rbTable, renderbuffer);
        if (!fbo->renderbuffer)
        {
            CRSTATE_CHECKERR(!crHashtableIsKeyUsed(g->shared->rbTable, renderbuffer), GL_INVALID_OPERATION, "name is not a renderbuffer");
            fbo->renderbuffer = crStateRenderbufferAllocate(g, renderbuffer);
        }
        CR_STATE_SHAREDOBJ_USAGE_SET(fbo->renderbuffer, g);
    }
    else fbo->renderbuffer = NULL;
}
开发者ID:Klanly,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:21,代码来源:state_framebuffer.c

示例6: crStatePolygonMode

void  STATE_APIENTRY crStatePolygonMode (GLenum face, GLenum mode) 
{
	CRContext *g = GetCurrentContext();
	CRPolygonState *p = &(g->polygon);
        CRStateBits *sb = GetCurrentBits();
	CRPolygonBits *pb = &(sb->polygon);

	if (g->current.inBeginEnd) 
	{
		crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION,
				"glPolygonMode called in begin/end");
		return;
	}

	FLUSH();

	if (mode != GL_POINT && mode != GL_LINE && mode != GL_FILL)
	{
		crStateError(__LINE__, __FILE__, GL_INVALID_ENUM,
				"glPolygonMode called with bogus mode: 0x%x", mode);
		return;
	}

	switch (face) {
		case GL_FRONT:
			p->frontMode = mode;
			break;
		case GL_FRONT_AND_BACK:
			p->frontMode = mode;
		case GL_BACK:
			p->backMode = mode;
			break;
		default:
			crStateError(__LINE__, __FILE__, GL_INVALID_ENUM,
					"glPolygonMode called with bogus face: 0x%x", face);
			return;
	}
	DIRTY(pb->mode, g->neg_bitid);
	DIRTY(pb->dirty, g->neg_bitid);
}
开发者ID:L3oV1nc3,项目名称:VMGL,代码行数:40,代码来源:state_polygon.c

示例7: PlatformGetNewRenderQuery

void PlatformGetNewRenderQuery( GLuint* OutQuery, uint64* OutQueryContext )
{
	if( !ReleasedQueriesGuard )
	{
		ReleasedQueriesGuard = new FCriticalSection;
	}

	{
		FScopeLock Lock(ReleasedQueriesGuard);

#ifdef UE_BUILD_DEBUG
		check( OutQuery && OutQueryContext );
#endif

		HGLRC Context = GetCurrentContext();
		check( Context );

		GLuint NewQuery = 0;

		// Check for possible query reuse
		const int32 ArraySize = ReleasedQueries.Num();
		for( int32 Index = 0; Index < ArraySize; ++Index )
		{
			if( ReleasedQueries[Index].Context == Context )
			{
				NewQuery = ReleasedQueries[Index].Query;
				ReleasedQueries.RemoveAtSwap(Index);
				break;
			}
		}

		if( !NewQuery )
		{
			FOpenGL::GenQueries( 1, &NewQuery );
		}

		*OutQuery = NewQuery;
		*OutQueryContext = (uint64)Context;
	}
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:40,代码来源:OpenGLWindows.cpp

示例8: crStateSecondaryColorPointerEXT

void STATE_APIENTRY crStateSecondaryColorPointerEXT(GLint size,
		GLenum type, GLsizei stride, const GLvoid *p)
{
	CRContext *g = GetCurrentContext();
	CRClientState *c = &(g->client);
	CRStateBits *sb = GetCurrentBits();
	CRClientBits *cb = &(sb->client);

	FLUSH();

	if ( !g->extensions.EXT_secondary_color )
	{
		crError( "glSecondaryColorPointerEXT called but EXT_secondary_color is disabled." );
		return;
	}

	if (size != 3)
	{
		crStateError(__LINE__, __FILE__, GL_INVALID_VALUE, "glSecondaryColorPointerEXT: invalid size: %d", size);
		return;
	}
	if (type != GL_BYTE && type != GL_UNSIGNED_BYTE &&
			type != GL_SHORT && type != GL_UNSIGNED_SHORT &&
			type != GL_INT && type != GL_UNSIGNED_INT &&
			type != GL_FLOAT && type != GL_DOUBLE)
	{
		crStateError(__LINE__, __FILE__, GL_INVALID_ENUM, "glSecondaryColorPointerEXT: invalid type: 0x%x", type);
		return;
	}
	if (stride < 0) 
	{
		crStateError(__LINE__, __FILE__, GL_INVALID_VALUE, "glSecondaryColorPointerEXT: stride was negative: %d", stride);
		return;
	}

	crStateClientSetPointer(&(c->array.s), size, type, GL_TRUE, stride, p);
	DIRTY(cb->dirty, g->neg_bitid);
	DIRTY(cb->clientPointer, g->neg_bitid);
	DIRTY(cb->s, g->neg_bitid);
}
开发者ID:L3oV1nc3,项目名称:VMGL,代码行数:40,代码来源:state_client.c

示例9: QString

/**
 *  \brief Get the currently selected key string
 *
 *   If no key is selected, an empty string is returned.
 *
 *  \return The currently selected key string
 */
QString MythControls::GetCurrentKey(void)
{
    MythUIButtonListItem* currentButton;
    if (m_leftListType == kKeyList &&
        (currentButton = m_leftList->GetItemCurrent()))
    {
        return currentButton->GetText();
    }

    if (GetFocusWidget() == m_leftList)
        return QString();

    if ((m_leftListType == kContextList) && (m_rightListType == kActionList))
    {
        QString context = GetCurrentContext();
        QString action = GetCurrentAction();
        uint b = GetCurrentButton();
        QStringList keys = m_bindings->GetActionKeys(context, action);

        if (b < (uint)keys.count())
            return keys[b];

        return QString();
    }

    currentButton = m_rightList->GetItemCurrent();
    QString desc;
    if (currentButton)
        desc = currentButton->GetText();

    int loc = desc.indexOf(" => ");
    if (loc == -1)
        return QString(); // Should not happen


    if (m_rightListType == kKeyList)
        return desc.left(loc);

    return desc.mid(loc + 4);
}
开发者ID:JGunning,项目名称:OpenAOL-TV,代码行数:47,代码来源:mythcontrols.cpp

示例10: crStateClearDepth

void STATE_APIENTRY crStateClearDepth (GLclampd depth) 
{
    CRContext *g = GetCurrentContext();
    CRBufferState *b = &(g->buffer);
    CRStateBits *sp = GetCurrentBits();
    CRBufferBits *bb = &(sp->buffer);

    if (g->current.inBeginEnd)
    {
        crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glClearDepth called in begin/end");
        return;
    }

    FLUSH();

    if (depth < 0.0) depth = 0.0;
    if (depth > 1.0) depth = 1.0;

    b->depthClearValue = (GLdefault) depth;
    DIRTY(bb->dirty, g->neg_bitid);
    DIRTY(bb->clearDepth, g->neg_bitid);
}
开发者ID:MadHacker217,项目名称:VirtualBox-OSE,代码行数:22,代码来源:state_buffer.c

示例11: crStatePolygonOffset

void STATE_APIENTRY crStatePolygonOffset (PCRStateTracker pState, GLfloat factor, GLfloat units) 
{
    CRContext *g = GetCurrentContext(pState);
    CRPolygonState *p = &(g->polygon);
        CRStateBits *sb = GetCurrentBits(pState);
    CRPolygonBits *pb = &(sb->polygon);

    if (g->current.inBeginEnd) 
    {
        crStateError(pState, __LINE__, __FILE__, GL_INVALID_OPERATION,
                "glPolygonOffset called in begin/end");
        return;
    }

    FLUSH();

    p->offsetFactor = factor;
    p->offsetUnits = units;

    DIRTY(pb->offset, g->neg_bitid);
    DIRTY(pb->dirty, g->neg_bitid);
}
开发者ID:mdaniel,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:22,代码来源:state_polygon.c

示例12: __glstate_StencilMask

void GLSTATE_DECL
__glstate_StencilMask (GLuint mask) {
	GLcontext *g = GetCurrentContext();
	GLstencilstate *s = &(g->stencil);
	GLstatebits *stateb = GetStateBits();
	GLstencilbits *sb = &(stateb->stencil);

	/*ECHECK*/
	if (g->current.beginend)
		if (__glerror(__LINE__, __FILE__, GL_INVALID_OPERATION, 
			"glStencilMask called in begin/end"))
			return;

 
		
	/*ECHECK*/

	s->mask = mask;

	sb->writemask = g->nbitID;
	sb->dirty = g->nbitID;
}
开发者ID:kasicass,项目名称:glsim,代码行数:22,代码来源:glstencil.c

示例13: __glstate_ClearStencil

void GLSTATE_DECL
__glstate_ClearStencil (GLint c) {
	GLcontext *g = GetCurrentContext();
	GLstencilstate *s = &(g->stencil);
	GLstatebits *stateb = GetStateBits();
	GLstencilbits *sb = &(stateb->stencil);

	/*ECHECK*/
	if (g->current.beginend)
		if (__glerror(__LINE__, __FILE__, GL_INVALID_OPERATION, 
			"glClearStencil called in begin/end"))
			return;

 
		
	/*ECHECK*/

	s->clearvalue = c;
	
	sb->clearvalue = g->nbitID;
	sb->dirty = g->nbitID;
}
开发者ID:kasicass,项目名称:glsim,代码行数:22,代码来源:glstencil.c

示例14: crStateAlphaFunc

void STATE_APIENTRY crStateAlphaFunc (GLenum func, GLclampf ref) 
{
    CRContext *g             = GetCurrentContext();
    CRBufferState *b         = &(g->buffer);
    CRStateBits *sb          = GetCurrentBits();
    CRBufferBits *bb = &(sb->buffer);

    if (g->current.inBeginEnd)
    {
        crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glAlphaFunc called in begin/end");
        return;
    }

    FLUSH();

    switch (func) 
    {
        case GL_NEVER:
        case GL_LESS:
        case GL_EQUAL:
        case GL_LEQUAL:
        case GL_GREATER:
        case GL_GEQUAL:
        case GL_NOTEQUAL:
        case GL_ALWAYS:
            break;
        default:
            crStateError(__LINE__, __FILE__, GL_INVALID_ENUM, "glAlphaFunc:  Invalid func: %d", func);
            return;
    }

    if (ref < 0.0f) ref = 0.0f;
    if (ref > 1.0f) ref = 1.0f;

    b->alphaTestFunc = func;
    b->alphaTestRef = ref;
    DIRTY(bb->dirty, g->neg_bitid);
    DIRTY(bb->alphaFunc, g->neg_bitid);
}
开发者ID:MadHacker217,项目名称:VirtualBox-OSE,代码行数:39,代码来源:state_buffer.c

示例15: crStateColorMask

void STATE_APIENTRY crStateColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) 
{
    CRContext *g = GetCurrentContext();
    CRBufferState *b = &(g->buffer);
    CRStateBits *sp = GetCurrentBits();
    CRBufferBits *bb = &(sp->buffer);

    if (g->current.inBeginEnd)
    {
        crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, "glReadBuffer called in begin/end");
        return;
    }

    FLUSH();

    b->colorWriteMask.r = red;
    b->colorWriteMask.g = green;
    b->colorWriteMask.b = blue;
    b->colorWriteMask.a = alpha;
    DIRTY(bb->dirty, g->neg_bitid);
    DIRTY(bb->colorWriteMask, g->neg_bitid);
}
开发者ID:MadHacker217,项目名称:VirtualBox-OSE,代码行数:22,代码来源:state_buffer.c


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