本文整理匯總了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;
}
}
示例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;
}
}
示例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;
}
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}