Move gl_shader_set_coords from gl.c to gl_common.c

This commit is contained in:
twinaphex 2014-10-02 14:20:50 +02:00
parent 7e2dd769e9
commit aed7afb31d
2 changed files with 34 additions and 34 deletions

View File

@ -298,40 +298,6 @@ static void gl_disable_client_arrays(gl_t *gl)
}
#endif
void gl_shader_set_coords(gl_t *gl,
const struct gl_coords *coords, const math_matrix *mat)
{
if (!gl->shader->set_coords(coords))
{
#ifndef NO_GL_FF_VERTEX
/* Fall back to FF-style if needed and possible. */
glClientActiveTexture(GL_TEXTURE1);
glTexCoordPointer(2, GL_FLOAT, 0, coords->lut_tex_coord);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glClientActiveTexture(GL_TEXTURE0);
glVertexPointer(2, GL_FLOAT, 0, coords->vertex);
glEnableClientState(GL_VERTEX_ARRAY);
glColorPointer(4, GL_FLOAT, 0, coords->color);
glEnableClientState(GL_COLOR_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, coords->tex_coord);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
#endif
}
if (!gl->shader->set_mvp(gl, mat))
{
#ifndef NO_GL_FF_MATRIX
/* Fall back to FF-style if needed and possible. */
glMatrixMode(GL_PROJECTION);
glLoadMatrixf(mat->data);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
#endif
}
}
#ifdef IOS
/* There is no default frame buffer on iOS. */
void apple_bind_game_view_fbo(void);

View File

@ -83,3 +83,37 @@ bool gl_load_luts(const struct gfx_shader *generic_shader,
glBindTexture(GL_TEXTURE_2D, 0);
return true;
}
void gl_shader_set_coords(gl_t *gl,
const struct gl_coords *coords, const math_matrix *mat)
{
if (!gl->shader->set_coords(coords))
{
#ifndef NO_GL_FF_VERTEX
/* Fall back to FF-style if needed and possible. */
glClientActiveTexture(GL_TEXTURE1);
glTexCoordPointer(2, GL_FLOAT, 0, coords->lut_tex_coord);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glClientActiveTexture(GL_TEXTURE0);
glVertexPointer(2, GL_FLOAT, 0, coords->vertex);
glEnableClientState(GL_VERTEX_ARRAY);
glColorPointer(4, GL_FLOAT, 0, coords->color);
glEnableClientState(GL_COLOR_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, coords->tex_coord);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
#endif
}
if (!gl->shader->set_mvp(gl, mat))
{
#ifndef NO_GL_FF_MATRIX
/* Fall back to FF-style if needed and possible. */
glMatrixMode(GL_PROJECTION);
glLoadMatrixf(mat->data);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
#endif
}
}