diff options
author | Mike Pavone <pavone@retrodev.com> | 2013-10-27 21:41:21 -0700 |
---|---|---|
committer | Mike Pavone <pavone@retrodev.com> | 2013-10-27 21:41:21 -0700 |
commit | b5e181c3f87201b95e6b6e6b96de2ac15ed35f35 (patch) | |
tree | 99346e1d3bd27fe6b9e4ff7249305cb75098ef74 /render_sdl.c | |
parent | 7b604db493ad6663b864a5d1b9f509118f9860b2 (diff) |
Support interlace mode with OpenGL backend
--HG--
branch : opengl
Diffstat (limited to 'render_sdl.c')
-rw-r--r-- | render_sdl.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/render_sdl.c b/render_sdl.c index f62ba66..ad99025 100644 --- a/render_sdl.c +++ b/render_sdl.c @@ -160,7 +160,7 @@ void render_alloc_surfaces(vdp_context * context) if (i < 2) { glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 512, 256, 0, GL_BGRA, GL_UNSIGNED_BYTE, i ? context->evenbuf : context->oddbuf); } else { - uint32_t blank = 255; + uint32_t blank = 255 << 24; glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 1, 1, 0, GL_BGRA, GL_UNSIGNED_BYTE, &blank); } } @@ -332,8 +332,7 @@ void render_context_gl(vdp_context * context) glUniform1i(un_textures[0], 0); glActiveTexture(GL_TEXTURE1); - //TODO: Select appropriate texture based on status of interlace - glBindTexture(GL_TEXTURE_2D, textures[1]); + glBindTexture(GL_TEXTURE_2D, (context->regs[REG_MODE_4] & BIT_INTERLACE) ? textures[1] : textures[2]); glUniform1i(un_textures[1], 1); glBindBuffer(GL_ARRAY_BUFFER, buffers[0]); @@ -346,7 +345,10 @@ void render_context_gl(vdp_context * context) glDisableVertexAttribArray(at_pos); SDL_GL_SwapBuffers(); - + if (context->regs[REG_MODE_4] & BIT_INTERLACE) + { + context->framebuf = context->framebuf == context->oddbuf ? context->evenbuf : context->oddbuf; + } } uint32_t blankbuf[320*240]; |