/* ================ 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; }
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~---"); }
void GLHelper::MakeWorkerThreadContextCurrent() { //if (false) LOGD("----SWAP BACK TO PBUFFER----"); if (!_eglPBufferSurface) LOGD("PBuffer has somehow been destroyed (or was not created)"); MakeCurrent(_eglWorkerThreadContext, _eglPBufferSurface); //if (false) LOGD("---~SWAP BACK TO PBUFFER~---"); }
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; }
void ReadCurrentS(void) { ReadEnergyS(); mpdwBaseDig[0] = coEnergy.dwBuff*mpdbPulseMnt[ibDig]/wDividerS; MakeCurrent(); }
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); }
//--------------------------------------------------------------------------------------- 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); }
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); } }
//--------------------------------------------------------------------------------------- void z_ed3View::ReleaseRDI() { ////(HFONT)SelectObject(_hdc, 0); ::DeleteObject(_hf); MakeCurrent(_hdc, m_hRC); glDeleteLists(_font1, 96); TexRef::Clear(1); ::ReleaseDC(m_hWnd,_hdc); MakeCurrent(0,0); // wglDeleteContext(m_hRC); }
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; }
/** * @alsymbols * @alcfunref{CreateContext} * @alcfunref{MakeContextCurrent} */ ContextMadeCurrent( const Device& device, const FinishedContextAttribs& attribs ): Context(device, attribs) { MakeCurrent(); }
//--------------------------------------------------------------------------------------- void z_ed3View::OnSize(UINT nType, int cx, int cy) { CView::OnSize(nType, cx, cy); MakeCurrent(_hdc, m_hRC); Project3D(cx, cy); GetClientRect(&_rt); if(_rt.bottom==0)_rt.bottom=1; }
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; }
PRBool Init() { if (!mDC || !mContext) return PR_FALSE; MakeCurrent(); SetupLookupFunction(); return InitWithPrefix("gl", PR_TRUE); }
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); }
/* ================ rvClientEntity::RunPhysics ================ */ void rvClientEntity::RunPhysics( void ) { idPhysics* physics = GetPhysics(); if ( physics ) { MakeCurrent(); physics->Evaluate( gameLocal.time - gameLocal.previousTime, gameLocal.time ); worldOrigin = physics->GetOrigin(); worldAxis = physics->GetAxis(); ResetCurrent(); } }
PRBool Init() { MakeCurrent(); SetupLookupFunction(); if (!InitWithPrefix("gl", PR_TRUE)) { return PR_FALSE; } return IsExtensionSupported("GL_EXT_framebuffer_object"); }
void ReadCurrentQ(void) { uchar i; for (i=0; i<MAX_LINE_Q; i++) { mpdwBaseDig[i] = mpdbChannelsC[i] * mpdbPulseMnt[ibDig]; } MakeCurrent(); }
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; }
wxGLContext::~wxGLContext() { if ( !m_glContext ) return; if ( m_glContext == glXGetCurrentContext() ) MakeCurrent(None, NULL); glXDestroyContext( wxGetX11Display(), m_glContext ); }
bool P3DGLMemoryContextPBuffer::Create (unsigned int Width, unsigned int Height, bool NeedAlpha) { int PixelFormat; UINT FormatCount; HDC CurrDeviceContext; CurrDeviceContext = wglGetCurrentDC(); if (wglChoosePixelFormatARB( CurrDeviceContext, NeedAlpha ? PBufferPixelFormatIntAttrsAlpha : PBufferPixelFormatIntAttrsNoAlpha, NULL, 1, &PixelFormat, &FormatCount)) { if (FormatCount == 0) { return(false); } } else { return(false); } PBufferHandle = wglCreatePbufferARB (CurrDeviceContext, PixelFormat, Width, Height, PBufferAttrs); if (PBufferHandle == NULL) { return(false); } PBufferDC = wglGetPbufferDCARB(PBufferHandle); GLContext = wglCreateContext(PBufferDC); if (MakeCurrent()) { return(P3DGLExtInit()); } else { return(false); } return(true); }
bool nglContext::BuildOpenGLFromExisting(WindowRef Win, AGLContext Ctx) { mTargetAPI = eTargetAPI_OpenGL; mFullscreen = false; mCtx = Ctx; MakeCurrent(Win); return true; }
static Context *CreateContext(MFDevice *pDevice) { AudioDevice &device = *(AudioDevice*)pDevice->pInternal; if(!device.pDevice) device.pDevice = alcOpenDevice(pDevice->strings[MFDS_ID]); if(!device.pDevice) return NULL; Context *pContext = (Context*)MFHeap_Alloc(sizeof(Context)); pContext->pContext = alcCreateContext(device.pDevice, NULL); pContext->pDevice = pDevice; pContext->pRender = &device; Context *pOld = MakeCurrent(pContext); const char *pVersion = alGetString(AL_VERSION); const char *pExtensions = alGetString(AL_EXTENSIONS); MFDebug_Log(0, MFStr("OpenAL Version: %s", pVersion)); MFDebug_Log(0, MFStr("OpenAL Extensions: %s", pExtensions)); pContext->ext.static_buffer = alIsExtensionPresent("ALC_EXT_STATIC_BUFFER") == AL_TRUE; pContext->ext.offset = alIsExtensionPresent("AL_EXT_OFFSET") == AL_TRUE; pContext->ext.float32 = alIsExtensionPresent("AL_EXT_float32") == AL_TRUE; pContext->ext.source_radius = alIsExtensionPresent("AL_EXT_SOURCE_RADIUS") == AL_TRUE; pContext->ext.buffer_sub_data = alIsExtensionPresent("AL_SOFT_buffer_sub_data") == AL_TRUE; pContext->ext.buffer_samples = alIsExtensionPresent("AL_SOFT_buffer_samples") == AL_TRUE; if(pContext->ext.static_buffer) alBufferDataStatic = (PFNALBUFFERDATASTATICPROC)alGetProcAddress("alBufferDataStatic"); if(pContext->ext.buffer_sub_data) alBufferSubDataSOFT = (PFNALBUFFERSUBDATASOFTPROC)alGetProcAddress("alBufferSubDataSOFT"); alListener3f(AL_POSITION, 0, 0, 0); alListener3f(AL_VELOCITY, 0, 0, 0); alListener3f(AL_ORIENTATION, 0, 0, -1); MakeCurrent(pOld); return pContext; }
//--------------------------------------------------------------------------------------- void z_ed3View::BuildFont(HDC hDC) { MakeCurrent(_hdc, m_hRC); _font1 = glGenLists(96); _hf = CreateFont( -14, 0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, FF_DONTCARE | DEFAULT_PITCH, "Verdana" ); HFONT hf = (HFONT)SelectObject(_hdc, _hf); wglUseFontBitmaps(_hdc, 32, 96, _font1); SelectObject(_hdc, hf); }
void EglDisplayImpl::Shutdown() { Mutex::Autolock mutex(&lock_); if (!initialized_) { return; } MakeCurrent(EGL_NO_CONTEXT, EGL_NO_SURFACE, EGL_NO_SURFACE); contexts_.Unregister(global_context_); global_context_ = NULL; Native::DestroyNativeWindow(window_); window_ = NULL; }
bool Init() { if (!mDC || !mContext) return false; MakeCurrent(); SetupLookupFunction(); if (!InitWithPrefix("gl", true)) return false; return true; }
void ReadCurrent34(void) { ReadEng34(); uchar i; for (i=0; i<MAX_LINE_N34; i++) { mpdwBaseDig[i] = mpddwChannels34[i] / 100; } MakeCurrent(); }
void GLHelper::CreateNewSurfaceAndMakeCurrent(ANativeWindow* nativeWindow, EGLSurface& newSurface) { if (false) LOGD("----NEW SURFACE AND MAKE CURRENT----"); // Create the new suface from the ANativeWindow we got from the Java Surface CreateEGLSurfaceFromANativeWindow(nativeWindow, GLHelper::_eglRenderConfig, newSurface); // Make the new setup current, we swap back to pbuffer when we suspend MakeCurrent(GLHelper::_eglSurfaceContext, newSurface); if (false) LOGD("---~NEW SURFACE AND MAKE CURRENT~---"); }
void TargetSettingsWin::ShowSelectedView(int32 index) { DPRINT("TargetSettingsWin::ShowSelectedView: index = " << index); switch (index) { case GENERAL_SETTINGS_INDEX: MakeCurrent(fGeneralSettingsView); break; case INCLUDE_PATHS_INDEX: MakeCurrent(fIncludeSettingsView); break; case COMPILER_OPTIONS_INDEX: MakeCurrent(fCompilerSettingsView); break; case LINKER_OPTIONS_INDEX: MakeCurrent(fLinkerSettingsView); break; default: break; } }
//--------------------------------------------------------------------------------------- void z_ed3View::DrawInHrc(HDC hdc, BOOL update) { if(FRM()->m_bshutdown) return; MakeCurrent(hdc, m_hRC); Ta.Enable(); GetClientRect(&_rt); if(_rt.right && _rt.bottom) { Project3D(_rt.right, _rt.bottom); glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT); GLPaint(); if(DOC()->_glAddSwapHintRectWIN) (DOC()->_glAddSwapHintRectWIN)(0,0,_rt.right,_rt.bottom); SwapBuffers(hdc); if(update) glFlush(); } MakeCurrent(hdc, 0); }