activateTexture method

void activateTexture(
  1. FlutterAngleTexture texture
)

Implementation

void activateTexture(FlutterAngleTexture texture) {
  if(_disposed) return;
  if(Platform.isLinux){
    _libEGL!.makeCurrent(_baseAppContext);
  }

  _rawOpenGl.glViewport(0, 0, (texture.options.width*texture.options.dpr).toInt(),( texture.options.height*texture.options.dpr).toInt());
  _rawOpenGl.glBindFramebuffer(GL_FRAMEBUFFER, texture.fboId);

  // If we have an iOS EGL surface created from IOSurface, use it
  if (_useSurface && texture.surfaceId != nullptr) {
    _libEGL!.eglMakeCurrent(_display, texture.surfaceId!, texture.surfaceId!, _baseAppContext);
    return;
  }

  if (!_isRBO) _rawOpenGl.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D, texture.rboId, 0);
  else _rawOpenGl.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, texture.rboId);
  _activeFramebuffer = texture.fboId;
}