本文整理汇总了C++中GstGLFuncs类的典型用法代码示例。如果您正苦于以下问题:C++ GstGLFuncs类的具体用法?C++ GstGLFuncs怎么用?C++ GstGLFuncs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GstGLFuncs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gst_gl_effects_twirl_callback
static void
gst_gl_effects_twirl_callback (gint width, gint height, guint texture,
gpointer data)
{
GstGLShader *shader;
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstGLFuncs *gl = context->gl_vtable;
shader = gst_gl_effects_get_fragment_shader (effects, "twirl",
twirl_fragment_source_gles2);
if (!shader)
return;
#if GST_GL_HAVE_OPENGL
if (USING_OPENGL (context)) {
gl->MatrixMode (GL_PROJECTION);
gl->LoadIdentity ();
}
#endif
gst_gl_shader_use (shader);
gl->ActiveTexture (GL_TEXTURE0);
gl->BindTexture (GL_TEXTURE_2D, texture);
gst_gl_shader_set_uniform_1i (shader, "tex", 0);
gst_gl_filter_draw_texture (filter, texture, width, height);
}
示例2: gst_3d_renderer_draw_stereo
void
gst_3d_renderer_draw_stereo (Gst3DRenderer * self, Gst3DScene * scene)
{
GstGLFuncs *gl = self->context->gl_vtable;
_insert_gl_debug_marker (self->context, "gst_3d_renderer_draw_stereo");
/* aquire current fbo id */
GLint bound_fbo;
gl->GetIntegerv (GL_DRAW_FRAMEBUFFER_BINDING, &bound_fbo);
if (bound_fbo == 0)
return;
Gst3DCameraHmd *hmd_cam = GST_3D_CAMERA_HMD (scene->camera);
/* left eye */
_draw_eye (self, self->left_fbo, scene, &hmd_cam->left_vp_matrix);
/* right eye */
_draw_eye (self, self->right_fbo, scene, &hmd_cam->right_vp_matrix);
gst_3d_scene_clear_state (scene);
gst_3d_shader_bind (self->shader);
gl->BindFramebuffer (GL_FRAMEBUFFER, bound_fbo);
gl->Clear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
_draw_framebuffers_on_planes (self);
gst_3d_scene_clear_state (scene);
}
示例3: gst_gl_effects_sobel_callback_vconv
static void
gst_gl_effects_sobel_callback_vconv (gint width, gint height, guint texture,
gpointer data)
{
GstGLShader *shader = NULL;
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLFilter *filter = GST_GL_FILTER (effects);
if (NULL != (shader = gst_gl_effects_get_fragment_shader (effects, "vconv0",
sep_sobel_vconv3_fragment_source_gles2,
sep_sobel_vconv3_fragment_source_opengl))) {
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
#if GST_GL_HAVE_OPENGL
if (USING_OPENGL (GST_GL_BASE_FILTER (filter)->context)) {
gl->MatrixMode (GL_PROJECTION);
gl->LoadIdentity ();
}
#endif
gst_gl_shader_use (shader);
gl->ActiveTexture (GL_TEXTURE0);
gl->BindTexture (GL_TEXTURE_2D, texture);
gst_gl_shader_set_uniform_1i (shader, "tex", 0);
gst_gl_shader_set_uniform_1f (shader, "height", height);
gst_gl_filter_draw_texture (filter, texture, width, height);
}
}
示例4: gst_gl_differencematte_reset_gl_resources
/* free resources that need a gl context */
static void
gst_gl_differencematte_reset_gl_resources (GstGLFilter * filter)
{
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (filter);
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
gint i;
gl->DeleteTextures (1, &differencematte->savedbgtexture);
gl->DeleteTextures (1, &differencematte->newbgtexture);
for (i = 0; i < 4; i++) {
if (differencematte->identity_shader) {
gst_object_unref (differencematte->identity_shader);
differencematte->identity_shader = NULL;
}
if (differencematte->shader[i]) {
gst_object_unref (differencematte->shader[i]);
differencematte->shader[i] = NULL;
}
if (differencematte->midtexture[i]) {
gl->DeleteTextures (1, &differencematte->midtexture[i]);
differencematte->midtexture[i] = 0;
}
}
differencematte->location = NULL;
differencematte->pixbuf = NULL;
differencematte->savedbgtexture = 0;
differencematte->newbgtexture = 0;
differencematte->bg_has_changed = FALSE;
}
示例5: _init_scene
static void
_init_scene (Gst3DScene * scene)
{
GstGLContext *context = scene->context;
GstGLFuncs *gl = context->gl_vtable;
GError *error = NULL;
Gst3DMesh *sphere_mesh;
Gst3DNode *sphere_node;
Gst3DShader *sphere_shader =
gst_3d_shader_new_vert_frag (context, "mvp_uv.vert",
"texture_uv.frag", &error);
if (sphere_shader == NULL) {
GST_WARNING ("Failed to create VR compositor shaders. Error: %s", error->message);
g_clear_error (&error);
return; /* FIXME: Add boolean return result */
}
sphere_mesh = gst_3d_mesh_new_sphere (context, 800.0, 100, 100);
sphere_node = gst_3d_node_new_from_mesh_shader (context, sphere_mesh, sphere_shader);
gst_3d_scene_append_node (scene, sphere_node);
gl->ClearColor (0.f, 0.f, 0.f, 0.f);
gl->ActiveTexture (GL_TEXTURE0);
gst_3d_shader_bind (sphere_shader);
gst_gl_shader_set_uniform_1i (sphere_shader->shader, "texture", 0);
}
示例6: gst_3d_scene_clear_state
void
gst_3d_scene_clear_state (Gst3DScene * self)
{
GstGLFuncs *gl = self->context->gl_vtable;
gl->BindVertexArray (0);
gl->BindTexture (GL_TEXTURE_2D, 0);
gst_gl_context_clear_shader (self->context);
}
示例7: _insert_gl_debug_marker
void
_insert_gl_debug_marker (GstGLContext * context, const gchar * message)
{
GstGLFuncs *gl = context->gl_vtable;
gl->DebugMessageInsert (GL_DEBUG_SOURCE_APPLICATION,
GL_DEBUG_TYPE_OTHER,
1, GL_DEBUG_SEVERITY_HIGH, strlen (message), message);
}
示例8: gst_gl_filter_glass_callback
//opengl scene, params: input texture (not the output filter->texture)
static void
gst_gl_filter_glass_callback (gpointer stuff)
{
static gint64 start_time = 0;
gfloat rotation;
GstGLFilter *filter = GST_GL_FILTER (stuff);
GstGLFilterGlass *glass_filter = GST_GL_FILTER_GLASS (stuff);
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
gint width = GST_VIDEO_INFO_WIDTH (&filter->out_info);
gint height = GST_VIDEO_INFO_HEIGHT (&filter->out_info);
guint texture = glass_filter->in_tex;
if (start_time == 0)
start_time = get_time ();
else {
gint64 time_left =
(glass_filter->timestamp / 1000) - (get_time () - start_time);
time_left -= 1000000 / 25;
if (time_left > 2000) {
GST_LOG ("escape");
return;
}
}
gst_gl_shader_use (glass_filter->passthrough_shader);
gst_gl_filter_glass_draw_background_gradient (glass_filter);
//Rotation
if (start_time != 0) {
gint64 time_passed = get_time () - start_time;
rotation = sin (time_passed / 1200000.0) * 45.0f;
} else {
rotation = 0.0f;
}
gl->Enable (GL_BLEND);
gl->BlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gst_gl_shader_use (glass_filter->shader);
//Reflection
gst_gl_filter_glass_draw_video_plane (filter, width, height, texture,
0.0f, 2.0f, 0.3f, 0.0f, TRUE, rotation);
//Main video
gst_gl_filter_glass_draw_video_plane (filter, width, height, texture,
0.0f, 0.0f, 1.0f, 1.0f, FALSE, rotation);
gst_gl_context_clear_shader (GST_GL_BASE_FILTER (filter)->context);
gl->Disable (GL_BLEND);
}
示例9: _draw_eye
static void
_draw_eye (Gst3DRenderer * self, GLuint fbo, Gst3DScene * scene,
graphene_matrix_t * mvp)
{
GstGLFuncs *gl = self->context->gl_vtable;
_insert_gl_debug_marker (self->context, "_draw_eye");
gl->BindFramebuffer (GL_FRAMEBUFFER, fbo);
gl->Viewport (0, 0, self->eye_width, self->eye_height);
gl->Clear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
gst_3d_scene_draw_nodes (scene, mvp);
}
示例10: deinit
static void
deinit (gpointer data)
{
GstGLContext *context = data;
GstGLFuncs *gl = context->gl_vtable;
gl->DeleteTextures (1, &tex);;
gst_object_unref (fbo);
#if GST_GL_HAVE_GLES2
if (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES2)
gst_object_unref (shader);
#endif
}
示例11: deinit
static void
deinit (gpointer data)
{
GstGLContext *context = data;
GstGLFuncs *gl = context->gl_vtable;
if (vao)
gl->DeleteVertexArrays (1, &vao);
gst_object_unref (fbo);
gst_object_unref (shader);
gst_memory_unref (GST_MEMORY_CAST (gl_tex));
gst_memory_unref (GST_MEMORY_CAST (gl_tex2));
}
示例12: gst_gl_differencematte_save_texture
static void
gst_gl_differencematte_save_texture (gint width, gint height, guint texture,
gpointer stuff)
{
GstGLFilter *filter = GST_GL_FILTER (stuff);
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
gl->MatrixMode (GL_PROJECTION);
gl->LoadIdentity ();
gst_gl_filter_draw_texture (filter, texture, width, height);
}
示例13: gst_gl_differencematte_interp
static void
gst_gl_differencematte_interp (gint width, gint height, guint texture,
gpointer stuff)
{
GstGLDifferenceMatte *differencematte = GST_GL_DIFFERENCEMATTE (stuff);
GstGLFilter *filter = GST_GL_FILTER (stuff);
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
gl->MatrixMode (GL_PROJECTION);
glLoadIdentity ();
gst_gl_shader_use (differencematte->shader[3]);
gl->ActiveTexture (GL_TEXTURE0);
gl->BindTexture (GL_TEXTURE_2D, texture);
gst_gl_shader_set_uniform_1i (differencematte->shader[3], "blend", 0);
gl->ActiveTexture (GL_TEXTURE1);
gl->BindTexture (GL_TEXTURE_2D, differencematte->newbgtexture);
gst_gl_shader_set_uniform_1i (differencematte->shader[3], "base", 1);
gl->ActiveTexture (GL_TEXTURE2);
gl->BindTexture (GL_TEXTURE_2D, differencematte->midtexture[2]);
gst_gl_shader_set_uniform_1i (differencematte->shader[3], "alpha", 2);
gst_gl_filter_draw_texture (filter, texture, width, height);
}
示例14: clear_tex
static void
clear_tex (gpointer data)
{
GstGLContext *context = data;
GstGLFuncs *gl = context->gl_vtable;
static gfloat r = 0.0, g = 0.0, b = 0.0;
gl->ClearColor (r, g, b, 1.0);
gl->Clear (GL_COLOR_BUFFER_BIT);
r = r > 1.0 ? 0.0 : r + 0.03;
g = g > 1.0 ? 0.0 : g + 0.01;
b = b > 1.0 ? 0.0 : b + 0.015;
}
示例15: gst_gl_context_clear_shader
/**
* gst_gl_context_clear_shader:
* @context: a #GstGLContext
*
* Clear's the currently set shader from the GL state machine.
*
* Note: must be called in the GL thread.
*/
void
gst_gl_context_clear_shader (GstGLContext * context)
{
GstGLFuncs *gl;
g_return_if_fail (GST_IS_GL_CONTEXT (context));
gl = context->gl_vtable;
if (gl->CreateProgram)
gl->UseProgram (0);
else if (gl->CreateProgramObject)
gl->UseProgramObject (0);
}