(renderchain) Start implementing set_coords/set_mvp

This commit is contained in:
twinaphex 2017-11-15 14:02:41 +01:00
parent bc969d0bf7
commit 2ac75f98ae
3 changed files with 38 additions and 0 deletions

View File

@ -261,7 +261,39 @@ static void gl1_renderchain_readback(void *data,
(GLenum)fmt, (GLenum)type, (GLvoid*)src);
}
static void gl1_renderchain_set_mvp(void *data,
void *shader_data, const void *mat_data)
{
math_matrix_4x4 ident;
const math_matrix_4x4 *mat = (const math_matrix_4x4*)mat_data;
/* Fall back to fixed function-style if needed and possible. */
glMatrixMode(GL_PROJECTION);
glLoadMatrixf(mat->data);
glMatrixMode(GL_MODELVIEW);
matrix_4x4_identity(ident);
glLoadMatrixf(ident.data);
}
static void gl1_renderchain_set_coords(void *handle_data,
void *shader_data, const struct video_coords *coords)
{
/* Fall back to fixed function-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);
}
gl_renderchain_driver_t gl2_renderchain = {
gl1_renderchain_set_coords,
gl1_renderchain_set_mvp,
NULL, /* init_textures_reference */
NULL, /* fence_iterate */
NULL, /* fence_free */

View File

@ -1437,6 +1437,8 @@ static void gl2_renderchain_init_textures_reference(
}
gl_renderchain_driver_t gl2_renderchain = {
NULL, /* set_coords */
NULL, /* set_mvp */
gl2_renderchain_init_textures_reference,
#ifdef HAVE_OPENGLES
NULL,

View File

@ -833,6 +833,10 @@ typedef struct d3d_renderchain_driver
typedef struct gl_renderchain_driver
{
void (*set_coords)(void *handle_data,
void *shader_data, const struct video_coords *coords);
void (*set_mvp)(void *data, void *shader_data,
const void *mat_data);
void (*init_texture_reference)(
void *data, unsigned i,
unsigned internal_fmt, unsigned texture_fmt,