Ejemplo n.º 1
0
  bool Initialize() {
    gbm_ = gbm_create_device(drm_->GetFD());
    if (!gbm_) {
      fprintf(stderr, "cannot create gbm device.\n");
      return false;
    }

    if (!InitializeEGL()) {
      fprintf(stderr, "cannot create EGL context.\n");
      return false;
    }

    DRMModesetter::Size display_size = drm_->GetDisplaySize();
    for (auto& framebuffer : framebuffers_) {
      if (!CreateFramebuffer(display_size.width, display_size.height,
                             framebuffer)) {
        fprintf(stderr, "cannot create framebuffer.\n");
        return false;
      }
    }

    // Need to do the first mode setting before page flip.
    if (!drm_->ModeSetCrtc())
      return false;

    return true;
  }
Ejemplo n.º 2
0
OpenGL::OpenGL(ANativeWindow * window)
{
	InitializeEGL(window);
	
	InitializeShaders();
}