本文整理汇总了C++中MakeCurrent函数的典型用法代码示例。如果您正苦于以下问题:C++ MakeCurrent函数的具体用法?C++ MakeCurrent怎么用?C++ MakeCurrent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MakeCurrent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitCurrent
/*
================
idUsercmdGenLocal::UsercmdInterrupt
Called asyncronously
================
*/
void idUsercmdGenLocal::UsercmdInterrupt( void ) {
// dedicated servers won't create usercmds
if ( !initialized ) {
return;
}
// init the usercmd for com_ticNumber+1
InitCurrent();
// process the system mouse events
Mouse();
// process the system keyboard events
Keyboard();
// process the system joystick events
Joystick();
// create the usercmd for com_ticNumber+1
MakeCurrent();
// save a number for debugging cmdDemos and networking
cmd.sequence = com_ticNumber+1;
buffered[(com_ticNumber+1) & (MAX_BUFFERED_USERCMD-1)] = cmd;
}
示例2: MakeCurrent
void GLHelper::SwapToDummySurface()
{
//if (false) LOGD("----SWAP BACK TO PBUFFER----");
if (!_eglDummySurface) LOGD("The DummySurface has somehow been destroyed (or was not created)");
MakeCurrent(_eglSurfaceContext, _eglDummySurface);
//if (false) LOGD("---~SWAP BACK TO PBUFFER~---");
}
示例3: SetActive
bool GlContext::SetActive(bool active)
{
if (active)
{
// Activate the context
if (MakeCurrent())
{
// If this is the first context to be activated on this thread, make
// it the reference context for the whole thread.
// referenceContext must *not* be the threadContext of the main thread
if (!threadContext && (this != &referenceContext))
threadContext = this;
return true;
}
}
else
{
// Deactivate the context
if (threadContext && (threadContext != this))
{
// To deactivate the context, we actually activate another one
// so that we make sure that there is always an active context
// for subsequent graphics operations
return threadContext->SetActive(true);
}
}
// If we got there then something failed
return false;
}
示例4: ReadCurrentS
void ReadCurrentS(void)
{
ReadEnergyS();
mpdwBaseDig[0] = coEnergy.dwBuff*mpdbPulseMnt[ibDig]/wDividerS;
MakeCurrent();
}
示例5: CloneSurface
void
CanvasClientSharedSurface::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
{
if (mFront) {
mPrevFront = mFront;
mFront = nullptr;
}
auto gl = aLayer->mGLContext;
gl->MakeCurrent();
if (aLayer->mGLFrontbuffer) {
mFront = CloneSurface(aLayer->mGLFrontbuffer.get(), aLayer->mFactory.get());
if (mFront)
mFront->Surf()->Fence();
} else {
mFront = gl->Screen()->Front();
if (!mFront)
return;
}
MOZ_ASSERT(mFront);
// Alright, now sort out the IPC goop.
SharedSurface* surf = mFront->Surf();
auto forwarder = GetForwarder();
auto flags = GetTextureFlags() | TextureFlags::IMMUTABLE;
// Get a TexClient from our surf.
RefPtr<TextureClient> newTex = TexClientFromShSurf(surf, flags);
if (!newTex) {
auto manager = aLayer->ClientManager();
auto shadowForwarder = manager->AsShadowForwarder();
auto layersBackend = shadowForwarder->GetCompositorBackendType();
newTex = TexClientFromReadback(surf, forwarder, flags, layersBackend);
}
MOZ_ASSERT(newTex);
// Add the new TexClient.
MOZ_ALWAYS_TRUE( AddTextureClient(newTex) );
// Remove the old TexClient.
if (mFrontTex) {
// remove old buffer from CompositableHost
RefPtr<AsyncTransactionTracker> tracker = new RemoveTextureFromCompositableTracker();
// Hold TextureClient until transaction complete.
tracker->SetTextureClient(mFrontTex);
mFrontTex->SetRemoveFromCompositableTracker(tracker);
// RemoveTextureFromCompositableAsync() expects CompositorChild's presence.
GetForwarder()->RemoveTextureFromCompositableAsync(tracker, this, mFrontTex);
mFrontTex = nullptr;
}
// Use the new TexClient.
mFrontTex = newTex;
forwarder->UpdatedTexture(this, mFrontTex, nullptr);
forwarder->UseTexture(this, mFrontTex);
}
示例6: MakeCurrent
//---------------------------------------------------------------------------------------
void z_ed3View::Project3D(int iWidth, int iHeight)
{
MakeCurrent(_hdc, m_hRC);
if(iHeight == 0)
iHeight = 1;
if(DOC()->b_whitebk)
{
glClearColor(.8f, .8f, .8f, 0.0f);
}
else
{
if(DOC()->_bShowCsg)
glClearColor(0.11f, 0.11f, 0.11f, 0.0f);
else
glClearColor(.02f, .02f, .04f, 0.0f);
}
REAL farCam = _ffar;
/*
if(SCENE()._si.fogFar)
farCam = SCENE()._si.fogFar*_ffar;
*/
glViewport(0, 0, iWidth, iHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(_fov,(GLfloat)iWidth/(GLfloat)iHeight, _fnear, farCam);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
// MakeCurrent(_hdc, 0);
}
示例7: MakeCurrent
GLX::~GLX()
{
if (mDisplay) {
MakeCurrent(mDisplay, 0, 0);
}
if (mContext) {
DestroyContext(mDisplay, mContext);
}
if (mGLXPixmap) {
DestroyGLXPixmap(mDisplay, mGLXPixmap);
}
if (mPixmap) {
XFreePixmap(mDisplay, mPixmap);
}
if (mDisplay) {
XCloseDisplay(mDisplay);
}
if (mLibGL) {
dlclose(mLibGL);
}
}
示例8: int
void GlSpectrumAnalyzerWindow::FrameResized(float fwidth, float fheight)
{
int width = int(fwidth);
int height = int(fheight);
fprintf(stderr, "GlSpectrumAnalyzerWindow::FrameResized(%f, %f)\n", fwidth, fheight);
MakeCurrent();
// The OpenGL view has been resized, so we have to reconfigure our
// OpenGL context to reflect that.
if( height <= 0 ) height = 1; // prevent divide-by-zero
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluPerspective( 45.0, (float)width/(float)height, 0.1, 100.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
ReleaseCurrent();
Sync(); // not sure it does anything
needResize = false;
}
示例9: ContextMadeCurrent
/**
* @alsymbols
* @alcfunref{CreateContext}
* @alcfunref{MakeContextCurrent}
*/
ContextMadeCurrent(
const Device& device,
const FinishedContextAttribs& attribs
): Context(device, attribs)
{
MakeCurrent();
}
示例10: ReleaseThread
EGLBoolean EGLAPIENTRY ReleaseThread(void)
{
EVENT("()");
MakeCurrent(EGL_NO_DISPLAY, EGL_NO_CONTEXT, EGL_NO_SURFACE, EGL_NO_SURFACE);
SetGlobalError(Error(EGL_SUCCESS));
return EGL_TRUE;
}
示例11: Init
PRBool Init()
{
if (!mDC || !mContext)
return PR_FALSE;
MakeCurrent();
SetupLookupFunction();
return InitWithPrefix("gl", PR_TRUE);
}
示例12: wxCHECK2_MSG
bool wxGLContext::SetCurrent(const wxGLCanvas& win) const
{
if ( !m_glContext )
return false;
const Window xid = win.GetXWindow();
wxCHECK2_MSG( xid, return false, wxT("window must be shown") );
return MakeCurrent(xid, m_glContext);
}
示例13: Init
PRBool Init()
{
MakeCurrent();
SetupLookupFunction();
if (!InitWithPrefix("gl", PR_TRUE)) {
return PR_FALSE;
}
return IsExtensionSupported("GL_EXT_framebuffer_object");
}
示例14: ReadCurrentQ
void ReadCurrentQ(void)
{
uchar i;
for (i=0; i<MAX_LINE_Q; i++)
{
mpdwBaseDig[i] = mpdbChannelsC[i] * mpdbPulseMnt[ibDig];
}
MakeCurrent();
}
示例15: ReleaseThread
EGLBoolean EGLAPIENTRY ReleaseThread(void)
{
EVENT("()");
Thread *thread = GetCurrentThread();
MakeCurrent(EGL_NO_DISPLAY, EGL_NO_CONTEXT, EGL_NO_SURFACE, EGL_NO_SURFACE);
thread->setError(NoError());
return EGL_TRUE;
}