Datastream manages its own video shader now

This commit is contained in:
John Alanbrook 2022-06-27 20:16:16 +00:00
parent 9c5767436d
commit f93b49e0d0
2 changed files with 8 additions and 5 deletions

View file

@ -8,6 +8,8 @@
#include <stdbool.h>
#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);

View file

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