From 77861f5a593862ec9e061e17061796574e370fd1 Mon Sep 17 00:00:00 2001 From: Themaister Date: Thu, 28 Mar 2013 01:19:48 +0100 Subject: [PATCH] Render something in motion. --- gfx/gl.c | 2 ++ libretro-test-gl/libretro-test.c | 35 +++++++++++++++++++------------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/gfx/gl.c b/gfx/gl.c index 0c7699fcc7..00db5e035d 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -1392,6 +1392,7 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei glEnable(GL_TEXTURE_2D); #endif glDisable(GL_DEPTH_TEST); + glDisable(GL_CULL_FACE); glDisable(GL_DITHER); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); @@ -1881,6 +1882,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo #endif glDisable(GL_DEPTH_TEST); + glDisable(GL_CULL_FACE); glDisable(GL_DITHER); memcpy(gl->tex_coords, tex_coords, sizeof(tex_coords)); diff --git a/libretro-test-gl/libretro-test.c b/libretro-test-gl/libretro-test.c index be1feab5e9..5f43e6c9d2 100644 --- a/libretro-test-gl/libretro-test.c +++ b/libretro-test-gl/libretro-test.c @@ -64,10 +64,10 @@ static void init_gl_proc(void) static GLuint prog; static const GLfloat vertex[] = { - 0.0, 0.0, - 1.0, 0.0, - 0.0, 1.0, - 1.0, 1.0, + -0.5, -0.5, + 0.5, -0.5, + -0.5, 0.5, + 0.5, 0.5, }; static const GLfloat color[] = { @@ -146,10 +146,10 @@ void retro_get_system_av_info(struct retro_system_av_info *info) }; info->geometry = (struct retro_game_geometry) { - .base_width = 320, - .base_height = 240, - .max_width = 320, - .max_height = 240, + .base_width = 512, + .base_height = 512, + .max_width = 512, + .max_height = 512, .aspect_ratio = 4.0 / 3.0, }; } @@ -197,20 +197,27 @@ void retro_run(void) pglBindFramebuffer(GL_FRAMEBUFFER, hw_render.get_current_framebuffer()); glClearColor(0.3, 0.4, 0.5, 1.0); - glViewport(0, 0, 320, 240); + glViewport(0, 0, 512, 512); glClear(GL_COLOR_BUFFER_BIT); pglUseProgram(prog); int loc = pglGetUniformLocation(prog, "uMVP"); - static const GLfloat identity[] = { - 1, 0, 0, 0, - 0, 1, 0, 0, + + static unsigned frame_count; + frame_count++; + float angle = frame_count / 100.0; + float cos_angle = cos(angle); + float sin_angle = sin(angle); + + const GLfloat mvp[] = { + cos_angle, -sin_angle, 0, 0, + sin_angle, cos_angle, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, }; - pglUniformMatrix4fv(loc, 1, GL_FALSE, identity); + pglUniformMatrix4fv(loc, 1, GL_FALSE, mvp); int vloc = pglGetAttribLocation(prog, "aVertex"); pglVertexAttribPointer(vloc, 2, GL_FLOAT, GL_FALSE, 0, vertex); @@ -224,7 +231,7 @@ void retro_run(void) pglDisableVertexAttribArray(vloc); pglDisableVertexAttribArray(cloc); - video_cb(RETRO_HW_FRAME_BUFFER_VALID, 320, 240, 0); + video_cb(RETRO_HW_FRAME_BUFFER_VALID, 512, 512, 0); } static void context_reset(void)