Don't use projection abstraction in GL.

Makes no sense anymore as it's calculated with gfx/math/ ...
Keep abstraction for XBox.
This commit is contained in:
Themaister 2012-09-24 22:51:26 +02:00
parent 9b5ea744ac
commit a1999af4a7
5 changed files with 20 additions and 58 deletions

View File

@ -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;

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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);
}