Add GStreamer support for video textures and update related files
- Introduced GStreamerTexture class for handling video frames. - Updated texture loading methods to include FromGStreamer. - Modified effect handling to support GStreamer textures. - Updated launch configuration and added new sample scripts.
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "globals.h"
|
||||
|
||||
#include "texture.h"
|
||||
#include "gstreamer_texture.h"
|
||||
|
||||
GLuint Effect::g_dummyVAO = 0;
|
||||
|
||||
@@ -107,16 +108,18 @@ GLuint Effect::GetUniformLocation(const std::string& name)
|
||||
return location;
|
||||
}
|
||||
|
||||
void Effect::SetSampler(const std::string &name, GLuint textureUnit)
|
||||
void Effect::SetTexture(const std::string &name, const Texture& texture, size_t textureUnit)
|
||||
{
|
||||
glUniform1i(GetUniformLocation(name), textureUnit);
|
||||
}
|
||||
|
||||
void Effect::SetTexture(const std::string &name, const Texture &texture, size_t textureUnit)
|
||||
{
|
||||
texture.Bind();
|
||||
glActiveTexture(GL_TEXTURE0 + static_cast<GLuint>(textureUnit));
|
||||
SetSampler(name, static_cast<GLuint>(textureUnit));
|
||||
texture.Bind();
|
||||
|
||||
GStreamerTexture* gstTexture = dynamic_cast<GStreamerTexture*>(const_cast<Texture*>(&texture));
|
||||
if (gstTexture) {
|
||||
// For GStreamerTexture, we need to call Update() to upload the latest frame data
|
||||
gstTexture->Update();
|
||||
}
|
||||
|
||||
glUniform1i(GetUniformLocation(name), static_cast<GLint>(textureUnit));
|
||||
}
|
||||
|
||||
void Effect::SetFloat(const std::string &name, float value)
|
||||
|
||||
Reference in New Issue
Block a user