video_core.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright 2014 Citra Emulator Project
  2. // Licensed under GPLv2
  3. // Refer to the license.txt file included.
  4. #include "common/common.h"
  5. #include "common/emu_window.h"
  6. #include "common/log.h"
  7. #include "core/core.h"
  8. #include "video_core/video_core.h"
  9. #include "video_core/renderer_base.h"
  10. #include "video_core/renderer_opengl/renderer_opengl.h"
  11. ////////////////////////////////////////////////////////////////////////////////////////////////////
  12. // Video Core namespace
  13. namespace VideoCore {
  14. EmuWindow* g_emu_window = NULL; ///< Frontend emulator window
  15. RendererBase* g_renderer = NULL; ///< Renderer plugin
  16. int g_current_frame = 0;
  17. /// Start the video core
  18. void Start() {
  19. if (g_emu_window == NULL) {
  20. ERROR_LOG(VIDEO, "VideoCore::Start called without calling Init()!");
  21. }
  22. }
  23. /// Initialize the video core
  24. void Init(EmuWindow* emu_window) {
  25. // Required in order for GLFW to work on Linux,
  26. // or for GL contexts above 2.x on OS X
  27. glewExperimental = GL_TRUE;
  28. g_emu_window = emu_window;
  29. g_emu_window->MakeCurrent();
  30. g_renderer = new RendererOpenGL();
  31. g_renderer->SetWindow(g_emu_window);
  32. g_renderer->Init();
  33. g_current_frame = 0;
  34. NOTICE_LOG(VIDEO, "initialized OK");
  35. }
  36. /// Shutdown the video core
  37. void Shutdown() {
  38. delete g_renderer;
  39. NOTICE_LOG(VIDEO, "shutdown OK");
  40. }
  41. } // namespace