diff --git a/gfx/context/drm_egl_ctx.c b/gfx/context/drm_egl_ctx.c index 7037956cb1..84fb0b75fc 100644 --- a/gfx/context/drm_egl_ctx.c +++ b/gfx/context/drm_egl_ctx.c @@ -603,23 +603,6 @@ void gfx_ctx_input_driver(const input_driver_t **input, void **input_data) *input_data = linuxinput; } -void gfx_ctx_set_projection(gl_t *gl, const struct gl_ortho *ortho, bool allow_rotate) -{ - // Calculate projection. - math_matrix proj; - matrix_ortho(&proj, ortho->left, ortho->right, - ortho->bottom, ortho->top, ortho->znear, ortho->zfar); - - if (allow_rotate) - { - math_matrix rot; - matrix_rotate_z(&rot, M_PI * gl->rotation / 180.0f); - matrix_multiply(&proj, &rot, &proj); - } - - gl->mvp = proj; -} - bool gfx_ctx_window_has_focus(void) { return g_inited; diff --git a/gfx/context/sdl_ctx.c b/gfx/context/sdl_ctx.c index 3b44365bc9..4cb7b2e67c 100644 --- a/gfx/context/sdl_ctx.c +++ b/gfx/context/sdl_ctx.c @@ -292,23 +292,6 @@ void gfx_ctx_input_driver(const input_driver_t **input, void **input_data) } #ifdef HAVE_OPENGL -void gfx_ctx_set_projection(gl_t *gl, const struct gl_ortho *ortho, bool allow_rotate) -{ - // Calculate projection. - math_matrix proj; - matrix_ortho(&proj, ortho->left, ortho->right, - ortho->bottom, ortho->top, ortho->znear, ortho->zfar); - - if (allow_rotate) - { - math_matrix rot; - matrix_rotate_z(&rot, M_PI * gl->rotation / 180.0f); - matrix_multiply(&proj, &rot, &proj); - } - - gl->mvp = proj; -} - // Enforce void (*)(void) as it's not really legal to cast void* to fn-pointer. // POSIX allows this, but strict C99 doesn't. gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *symbol) diff --git a/gfx/context/xegl_ctx.c b/gfx/context/xegl_ctx.c index 6d6a35d863..65b5f4da7a 100644 --- a/gfx/context/xegl_ctx.c +++ b/gfx/context/xegl_ctx.c @@ -224,7 +224,11 @@ bool gfx_ctx_init(void) EGL_GREEN_SIZE, 1, EGL_BLUE_SIZE, 1, EGL_DEPTH_SIZE, 1, +#ifdef HAVE_OPENGLES2 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, +#else + EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, +#endif EGL_NONE, }; @@ -389,23 +393,6 @@ void gfx_ctx_input_driver(const input_driver_t **input, void **input_data) x_input_set_disp_win((x11_input_t*)xinput, g_dpy, g_win); } -void gfx_ctx_set_projection(gl_t *gl, const struct gl_ortho *ortho, bool allow_rotate) -{ - // Calculate projection. - math_matrix proj; - matrix_ortho(&proj, ortho->left, ortho->right, - ortho->bottom, ortho->top, ortho->znear, ortho->zfar); - - if (allow_rotate) - { - math_matrix rot; - matrix_rotate_z(&rot, M_PI * gl->rotation / 180.0f); - matrix_multiply(&proj, &rot, &proj); - } - - gl->mvp = proj; -} - bool gfx_ctx_window_has_focus(void) { if (!g_inited) diff --git a/gfx/gfx_context.h b/gfx/gfx_context.h index 564863e571..f4aa394996 100644 --- a/gfx/gfx_context.h +++ b/gfx/gfx_context.h @@ -29,10 +29,6 @@ #define VID_HANDLE gl_t #endif -#if defined(HAVE_D3D8) || defined(HAVE_D3D9) -#define VID_HANDLE xdk_d3d_video_t -#endif - #if defined(HAVE_SDL) && !defined(__APPLE__) #include "SDL_syswm.h" #endif @@ -75,10 +71,11 @@ void gfx_ctx_get_available_resolutions(void); int gfx_ctx_check_resolution(unsigned resolution_id); #endif -#if defined(HAVE_OPENGL) || defined(HAVE_D3D9) || defined(HAVE_D3D8) typedef void (*gfx_ctx_proc_t)(void); -void gfx_ctx_set_projection(VID_HANDLE *gl, const struct gl_ortho *ortho, bool allow_rotate); gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *sym); + +#if defined(HAVE_D3D9) || defined(HAVE_D3D8) +void gfx_ctx_set_projection(xdk_d3d_video_t *vid, const struct gl_ortho *ortho, bool allow_rotate); #endif #endif diff --git a/gfx/gl.c b/gfx/gl.c index 612756bc4d..bdb152de80 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -589,7 +589,19 @@ void gl_set_projection(gl_t *gl, struct gl_ortho *ortho, bool allow_rotate) } #endif - gfx_ctx_set_projection(gl, ortho, allow_rotate); + // Calculate projection. + math_matrix proj; + matrix_ortho(&proj, ortho->left, ortho->right, + ortho->bottom, ortho->top, ortho->znear, ortho->zfar); + + if (allow_rotate) + { + math_matrix rot; + matrix_rotate_z(&rot, M_PI * gl->rotation / 180.0f); + matrix_multiply(&proj, &rot, &proj); + } + + gl->mvp = proj; gl_shader_set_coords(&gl->coords, &gl->mvp); }