diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2014-08-28 11:34:47 +0200 |
---|---|---|
committer | Tony Wasserka <NeoBrainX@gmail.com> | 2014-10-12 14:37:24 +0200 |
commit | 5f598a5e2c574ebc854fa5d9cc0d02fda46e56d8 (patch) | |
tree | 6b55f40789e3a6b475c5ab8ccb79716d59498e9c /src | |
parent | Remove virtual inheritance from RendererOpenGL (diff) | |
download | yuzu-5f598a5e2c574ebc854fa5d9cc0d02fda46e56d8.tar yuzu-5f598a5e2c574ebc854fa5d9cc0d02fda46e56d8.tar.gz yuzu-5f598a5e2c574ebc854fa5d9cc0d02fda46e56d8.tar.bz2 yuzu-5f598a5e2c574ebc854fa5d9cc0d02fda46e56d8.tar.lz yuzu-5f598a5e2c574ebc854fa5d9cc0d02fda46e56d8.tar.xz yuzu-5f598a5e2c574ebc854fa5d9cc0d02fda46e56d8.tar.zst yuzu-5f598a5e2c574ebc854fa5d9cc0d02fda46e56d8.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.cpp | 33 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.h | 10 |
2 files changed, 18 insertions, 25 deletions
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index bc1683cb5..cad278381 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -81,7 +81,7 @@ void RendererOpenGL::SwapBuffers() { RenderXFB(framebuffer_size, framebuffer_size); // XFB->Window copy - RenderFramebuffer(); + DrawScreens(); // Swap buffers render_window->PollEvents(); @@ -151,8 +151,16 @@ void RendererOpenGL::RenderXFB(const Common::Rect& src_rect, const Common::Rect& // so this may need to be changed (pair for each screen). } -/// Initialize the FBO -void RendererOpenGL::InitFramebuffer() { +/** + * Initializes the OpenGL state and creates persistent objects. + */ +void RendererOpenGL::InitOpenGLObjects() { + glGenVertexArrays(1, &vertex_array_id); + glBindVertexArray(vertex_array_id); + + glClearColor(1.0f, 1.0f, 1.0f, 0.0f); + glDisable(GL_DEPTH_TEST); + program_id = ShaderUtil::LoadShaders(GLShaders::g_vertex_shader, GLShaders::g_fragment_shader); sampler_id = glGetUniformLocation(program_id, "sampler"); attrib_position = glGetAttribLocation(program_id, "position"); @@ -190,7 +198,10 @@ void RendererOpenGL::InitFramebuffer() { glBindTexture(GL_TEXTURE_2D, 0); } -void RendererOpenGL::RenderFramebuffer() { +/** + * Draws the emulated screens to the emulator window. + */ +void RendererOpenGL::DrawScreens() { glViewport(0, 0, resolution_width, resolution_height); glClear(GL_COLOR_BUFFER_BIT); @@ -253,20 +264,8 @@ void RendererOpenGL::Init() { exit(-1); } - // Generate VAO - glGenVertexArrays(1, &vertex_array_id); - glBindVertexArray(vertex_array_id); - - glClearColor(1.0f, 1.0f, 1.0f, 0.0f); - glDisable(GL_DEPTH_TEST); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - - // Initialize everything else - // -------------------------- - InitFramebuffer(); - NOTICE_LOG(RENDER, "GL_VERSION: %s\n", glGetString(GL_VERSION)); + InitOpenGLObjects(); } /// Shutdown the renderer diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h index 98ae7aa66..3dcb331be 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.h +++ b/src/video_core/renderer_opengl/renderer_opengl.h @@ -42,14 +42,8 @@ public: void ShutDown(); private: - - /// Initialize the FBO - void InitFramebuffer(); - - // Blit the FBO to the OpenGL default framebuffer - void RenderFramebuffer(); - - /// Updates the framerate + void InitOpenGLObjects(); + void DrawScreens(); void UpdateFramerate(); /// Structure used for storing information for rendering each 3DS screen |