diff --git a/source/engine/datastream.c b/source/engine/datastream.c index ed29cfb..ce10ada 100755 --- a/source/engine/datastream.c +++ b/source/engine/datastream.c @@ -8,6 +8,8 @@ #include #include "log.h" +struct mShader *vid_shader; + static void ds_update_texture(uint32_t unit, uint32_t texture, plm_plane_t * plane) { @@ -63,11 +65,12 @@ void ds_openvideo(struct datastream *ds, const char *video, const char *adriver) ds->playing = true; } -struct datastream *MakeDatastream(struct mShader *shader) +struct datastream *MakeDatastream() { - struct datastream *newds = - (struct datastream *) malloc(sizeof(struct datastream)); - newds->shader = shader; + struct datastream *newds = malloc(sizeof(*newds)); + if (!vid_shader) vid_shader = MakeShader("videovert.glsl", "videofrag.glsl"); + + newds->shader = vid_shader; shader_use(newds->shader); glGenTextures(1, &newds->texture_y); glBindTexture(GL_TEXTURE_2D, newds->texture_y); diff --git a/source/engine/datastream.h b/source/engine/datastream.h index ec84d28..c608155 100755 --- a/source/engine/datastream.h +++ b/source/engine/datastream.h @@ -15,7 +15,7 @@ struct datastream { uint32_t texture_cr; }; -struct datastream *MakeDatastream(struct mShader *shader); +struct datastream *MakeDatastream(); void ds_openvideo(struct datastream *ds, const char *path, const char *adriver); void ds_advance(struct datastream *ds, uint32_t ms);