本文整理汇总了C++中GstGLFuncs::Disable方法的典型用法代码示例。如果您正苦于以下问题:C++ GstGLFuncs::Disable方法的具体用法?C++ GstGLFuncs::Disable怎么用?C++ GstGLFuncs::Disable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GstGLFuncs
的用法示例。
在下文中一共展示了GstGLFuncs::Disable方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
gst_gl_effects_xray_step_five (gint width, gint height, guint texture,
gpointer data)
{
GstGLShader *shader;
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLFuncs *gl = context->gl_vtable;
shader = g_hash_table_lookup (effects->shaderstable, "xray4");
if (!shader) {
shader = gst_gl_shader_new (context);
g_hash_table_insert (effects->shaderstable, "xray4", shader);
}
if (!gst_gl_shader_compile_and_check (shader,
multiply_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
gst_gl_context_set_error (context, "Failed to initialize multiply shader");
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
("%s", gst_gl_context_get_error ()), (NULL));
return;
}
gl->MatrixMode (GL_PROJECTION);
gl->LoadIdentity ();
gst_gl_shader_use (shader);
gl->ActiveTexture (GL_TEXTURE2);
gl->Enable (GL_TEXTURE_2D);
gl->BindTexture (GL_TEXTURE_2D, effects->midtexture[2]);
gl->Disable (GL_TEXTURE_2D);
gst_gl_shader_set_uniform_1i (shader, "base", 2);
gl->ActiveTexture (GL_TEXTURE1);
gl->Enable (GL_TEXTURE_2D);
gl->BindTexture (GL_TEXTURE_2D, texture);
gl->Disable (GL_TEXTURE_2D);
gst_gl_shader_set_uniform_1f (shader, "alpha", (gfloat) 0.5f);
gst_gl_shader_set_uniform_1i (shader, "blend", 1);
gst_gl_filter_draw_texture (filter, texture, width, height);
}
开发者ID:freedesktop-unofficial-mirror,项目名称:gstreamer__attic__gst-plugins-gl,代码行数:47,代码来源:gstgleffectxray.c
示例2: sin
//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);
}
示例3:
static gboolean
_scene_geometry_draw (gpointer impl)
{
struct GeometryScene *self = impl;
g_return_val_if_fail (self->base.context, FALSE);
GstGLFuncs *gl = self->base.context->gl_vtable;
/*
gst_gl_shader_use (self->shader->shader);
gst_gl_shader_set_uniform_1f (self->shader->shader, "time",
(gfloat) self->base.src->running_time / GST_SECOND);
*/
gl->Enable (GL_DEPTH_TEST);
gl->Clear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
gst_3d_scene_draw (self->scene);
gl->Disable (GL_DEPTH_TEST);
return TRUE;
}
示例4:
static void
gst_gl_effects_xray_sobel_length (gint width, gint height, guint texture,
gpointer data)
{
GstGLShader *shader;
GstGLEffects *effects = GST_GL_EFFECTS (data);
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLFuncs *gl = context->gl_vtable;
shader = g_hash_table_lookup (effects->shaderstable, "xray_sob_len");
if (!shader) {
shader = gst_gl_shader_new (context);
g_hash_table_insert (effects->shaderstable, (gchar *) "xray_sob_len",
shader);
}
if (!gst_gl_shader_compile_and_check (shader,
sep_sobel_length_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
gst_gl_context_set_error (context,
"Failed to initialize seobel length shader");
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
("%s", gst_gl_context_get_error ()), (NULL));
return;
}
gl->MatrixMode (GL_PROJECTION);
gl->LoadIdentity ();
gst_gl_shader_use (shader);
gl->ActiveTexture (GL_TEXTURE1);
gl->Enable (GL_TEXTURE_2D);
gl->BindTexture (GL_TEXTURE_2D, texture);
gl->Disable (GL_TEXTURE_2D);
gst_gl_shader_set_uniform_1i (shader, "tex", 1);
gst_gl_shader_set_uniform_1i (shader, "invert", TRUE);
gst_gl_filter_draw_texture (filter, texture, width, height);
}
示例5: while
/* opengl scene, params: input texture (not the output mixer->texture) */
static void
gst_gl_video_mixer_callback (gpointer stuff)
{
GstGLVideoMixer *video_mixer = GST_GL_VIDEO_MIXER (stuff);
GstVideoAggregator *vagg = GST_VIDEO_AGGREGATOR (stuff);
GstGLMixer *mixer = GST_GL_MIXER (video_mixer);
GstGLFuncs *gl = GST_GL_BASE_MIXER (mixer)->context->gl_vtable;
GLint attr_position_loc = 0;
GLint attr_texture_loc = 0;
guint out_width, out_height;
guint count = 0;
out_width = GST_VIDEO_INFO_WIDTH (&vagg->info);
out_height = GST_VIDEO_INFO_HEIGHT (&vagg->info);
gst_gl_context_clear_shader (GST_GL_BASE_MIXER (mixer)->context);
gl->BindTexture (GL_TEXTURE_2D, 0);
gl->Disable (GL_DEPTH_TEST);
gl->Disable (GL_CULL_FACE);
if (gl->GenVertexArrays) {
if (!video_mixer->vao)
gl->GenVertexArrays (1, &video_mixer->vao);
gl->BindVertexArray (video_mixer->vao);
}
if (!_draw_background (video_mixer))
return;
gst_gl_shader_use (video_mixer->shader);
attr_position_loc =
gst_gl_shader_get_attribute_location (video_mixer->shader, "a_position");
attr_texture_loc =
gst_gl_shader_get_attribute_location (video_mixer->shader, "a_texCoord");
gl->Enable (GL_BLEND);
while (count < video_mixer->input_frames->len) {
GstGLMixerFrameData *frame;
GstGLVideoMixerPad *pad;
GstVideoInfo *v_info;
guint in_tex;
guint in_width, in_height;
/* *INDENT-OFF* */
gfloat v_vertices[] = {
-1.0,-1.0,-1.0f, 0.0f, 0.0f,
1.0,-1.0,-1.0f, 1.0f, 0.0f,
1.0, 1.0,-1.0f, 1.0f, 1.0f,
-1.0, 1.0,-1.0f, 0.0f, 1.0f,
};
/* *INDENT-ON* */
frame = g_ptr_array_index (video_mixer->input_frames, count);
if (!frame) {
GST_DEBUG ("skipping texture, null frame");
count++;
continue;
}
pad = (GstGLVideoMixerPad *) frame->pad;
v_info = &GST_VIDEO_AGGREGATOR_PAD (pad)->info;
in_width = GST_VIDEO_INFO_WIDTH (v_info);
in_height = GST_VIDEO_INFO_HEIGHT (v_info);
if (!frame->texture || in_width <= 0 || in_height <= 0
|| pad->alpha == 0.0f) {
GST_DEBUG ("skipping texture:%u frame:%p width:%u height:%u alpha:%f",
frame->texture, frame, in_width, in_height, pad->alpha);
count++;
continue;
}
in_tex = frame->texture;
_init_vbo_indices (video_mixer);
if (pad->geometry_change || !pad->vertex_buffer) {
gint pad_width, pad_height;
gfloat w, h;
_mixer_pad_get_output_size (video_mixer, pad, &pad_width, &pad_height);
w = ((gfloat) pad_width / (gfloat) out_width);
h = ((gfloat) pad_height / (gfloat) out_height);
/* top-left */
v_vertices[0] = v_vertices[15] =
2.0f * (gfloat) pad->xpos / (gfloat) out_width - 1.0f;
/* bottom-left */
v_vertices[1] = v_vertices[6] =
2.0f * (gfloat) pad->ypos / (gfloat) out_height - 1.0f;
/* top-right */
v_vertices[5] = v_vertices[10] = v_vertices[0] + 2.0f * w;
/* bottom-right */
v_vertices[11] = v_vertices[16] = v_vertices[1] + 2.0f * h;
//.........这里部分代码省略.........
示例6: while
//.........这里部分代码省略.........
gst_gl_shader_get_attribute_location (mosaic->shader, "a_position");
attr_texture_loc =
gst_gl_shader_get_attribute_location (mosaic->shader, "a_texCoord");
GST_OBJECT_LOCK (mosaic);
walk = GST_ELEMENT (mosaic)->sinkpads;
while (walk) {
GstGLMixerPad *pad = walk->data;
/* *INDENT-OFF* */
gfloat v_vertices[] = {
/* front face */
1.0f, 1.0f,-1.0f, 1.0f, 0.0f,
1.0f,-1.0f,-1.0f, 1.0f, 1.0f,
-1.0f,-1.0f,-1.0f, 0.0f, 1.0f,
-1.0f, 1.0f,-1.0f, 0.0f, 0.0f,
/* right face */
1.0f, 1.0f, 1.0f, 1.0f, 0.0f,
1.0f,-1.0f, 1.0f, 0.0f, 0.0f,
1.0f,-1.0f,-1.0f, 0.0f, 1.0f,
1.0f, 1.0f,-1.0f, 1.0f, 1.0f,
/* left face */
-1.0f, 1.0f, 1.0f, 1.0f, 0.0f,
-1.0f, 1.0f,-1.0f, 1.0f, 1.0f,
-1.0f,-1.0f,-1.0f, 0.0f, 1.0f,
-1.0f,-1.0f, 1.0f, 0.0f, 0.0f,
/* top face */
1.0f,-1.0f, 1.0f, 1.0f, 0.0f,
-1.0f,-1.0f, 1.0f, 0.0f, 0.0f,
-1.0f,-1.0f,-1.0f, 0.0f, 1.0f,
1.0f,-1.0f,-1.0f, 1.0f, 1.0f,
/* bottom face */
1.0f, 1.0f, 1.0f, 1.0f, 0.0f,
1.0f, 1.0f,-1.0f, 1.0f, 1.0f,
-1.0f, 1.0f,-1.0f, 0.0f, 1.0f,
-1.0f, 1.0f, 1.0f, 0.0f, 0.0f,
/* back face */
1.0f, 1.0f, 1.0f, 1.0f, 0.0f,
-1.0f, 1.0f, 1.0f, 0.0f, 0.0f,
-1.0f,-1.0f, 1.0f, 0.0f, 1.0f,
1.0f,-1.0f, 1.0f, 1.0f, 1.0f
};
/* *INDENT-ON* */
guint in_tex;
guint width, height;
in_tex = pad->current_texture;
width = GST_VIDEO_INFO_WIDTH (&GST_VIDEO_AGGREGATOR_PAD (pad)->info);
height = GST_VIDEO_INFO_HEIGHT (&GST_VIDEO_AGGREGATOR_PAD (pad)->info);
if (!in_tex || width <= 0 || height <= 0) {
GST_DEBUG ("skipping texture:%u pad:%p width:%u height %u",
in_tex, pad, width, height);
count++;
walk = g_list_next (walk);
continue;
}
GST_TRACE ("processing texture:%u dimensions:%ux%u", in_tex, width, height);
gl->VertexAttribPointer (attr_position_loc, 3, GL_FLOAT,
GL_FALSE, 5 * sizeof (GLfloat), &v_vertices[5 * 4 * count]);
gl->VertexAttribPointer (attr_texture_loc, 2, GL_FLOAT,
GL_FALSE, 5 * sizeof (GLfloat), &v_vertices[5 * 4 * count + 3]);
gl->EnableVertexAttribArray (attr_position_loc);
gl->EnableVertexAttribArray (attr_texture_loc);
gl->ActiveTexture (GL_TEXTURE0);
gl->BindTexture (GL_TEXTURE_2D, in_tex);
gst_gl_shader_set_uniform_1i (mosaic->shader, "s_texture", 0);
gst_gl_shader_set_uniform_1f (mosaic->shader, "xrot_degree", xrot);
gst_gl_shader_set_uniform_1f (mosaic->shader, "yrot_degree", yrot);
gst_gl_shader_set_uniform_1f (mosaic->shader, "zrot_degree", zrot);
gst_gl_shader_set_uniform_matrix_4fv (mosaic->shader, "u_matrix", 1,
GL_FALSE, matrix);
gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
++count;
walk = g_list_next (walk);
}
GST_OBJECT_UNLOCK (mosaic);
gl->DisableVertexAttribArray (attr_position_loc);
gl->DisableVertexAttribArray (attr_texture_loc);
gl->BindTexture (GL_TEXTURE_2D, 0);
gl->Disable (GL_DEPTH_TEST);
gst_gl_context_clear_shader (GST_GL_BASE_MIXER (mixer)->context);
xrot += 0.6f;
yrot += 0.4f;
zrot += 0.8f;
return TRUE;
}
示例7: sizeof
//.........这里部分代码省略.........
1.0, 1.0, -1.0, 1.0, 0.0,
1.0, -1.0, -1.0, 1.0, 1.0,
-1.0, -1.0, -1.0, 0.0, 1.0,
-1.0, 1.0, -1.0, 0.0, 0.0,
/* back face */
1.0, 1.0, 1.0, 1.0, 0.0,
-1.0, 1.0, 1.0, 0.0, 0.0,
-1.0, -1.0, 1.0, 0.0, 1.0,
1.0, -1.0, 1.0, 1.0, 1.0,
/* right face */
1.0, 1.0, 1.0, 1.0, 0.0,
1.0, -1.0, 1.0, 0.0, 0.0,
1.0, -1.0, -1.0, 0.0, 1.0,
1.0, 1.0, -1.0, 1.0, 1.0,
/* left face */
-1.0, 1.0, 1.0, 1.0, 0.0,
-1.0, 1.0, -1.0, 1.0, 1.0,
-1.0, -1.0, -1.0, 0.0, 1.0,
-1.0, -1.0, 1.0, 0.0, 0.0,
/* top face */
1.0, -1.0, 1.0, 1.0, 0.0,
-1.0, -1.0, 1.0, 0.0, 0.0,
-1.0, -1.0, -1.0, 0.0, 1.0,
1.0, -1.0, -1.0, 1.0, 1.0,
/* bottom face */
1.0, 1.0, 1.0, 1.0, 0.0,
1.0, 1.0, -1.0, 1.0, 1.0,
-1.0, 1.0, -1.0, 0.0, 1.0,
-1.0, 1.0, 1.0, 0.0, 0.0
};
/* *INDENT-ON* */
GLushort indices[] = {
0, 1, 2,
0, 2, 3,
4, 5, 6,
4, 6, 7,
8, 9, 10,
8, 10, 11,
12, 13, 14,
12, 14, 15,
16, 17, 18,
16, 18, 19,
20, 21, 22,
20, 22, 23
};
GLint attr_position_loc = 0;
GLint attr_texture_loc = 0;
const GLfloat matrix[] = {
0.5f, 0.0f, 0.0f, 0.0f,
0.0f, 0.5f, 0.0f, 0.0f,
0.0f, 0.0f, 0.5f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
};
gl->Enable (GL_DEPTH_TEST);
gl->ClearColor (cube_filter->red, cube_filter->green, cube_filter->blue, 0.0);
gl->Clear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
gst_gl_shader_use (cube_filter->shader);
attr_position_loc =
gst_gl_shader_get_attribute_location (cube_filter->shader, "a_position");
attr_texture_loc =
gst_gl_shader_get_attribute_location (cube_filter->shader, "a_texCoord");
/* Load the vertex position */
gl->VertexAttribPointer (attr_position_loc, 3, GL_FLOAT,
GL_FALSE, 5 * sizeof (GLfloat), v_vertices);
/* Load the texture coordinate */
gl->VertexAttribPointer (attr_texture_loc, 2, GL_FLOAT,
GL_FALSE, 5 * sizeof (GLfloat), &v_vertices[3]);
gl->EnableVertexAttribArray (attr_position_loc);
gl->EnableVertexAttribArray (attr_texture_loc);
gl->ActiveTexture (GL_TEXTURE0);
gl->BindTexture (GL_TEXTURE_2D, texture);
gst_gl_shader_set_uniform_1i (cube_filter->shader, "s_texture", 0);
gst_gl_shader_set_uniform_1f (cube_filter->shader, "xrot_degree", xrot);
gst_gl_shader_set_uniform_1f (cube_filter->shader, "yrot_degree", yrot);
gst_gl_shader_set_uniform_1f (cube_filter->shader, "zrot_degree", zrot);
gst_gl_shader_set_uniform_matrix_4fv (cube_filter->shader, "u_matrix", 1,
GL_FALSE, matrix);
gl->DrawElements (GL_TRIANGLES, 36, GL_UNSIGNED_SHORT, indices);
gl->DisableVertexAttribArray (attr_position_loc);
gl->DisableVertexAttribArray (attr_texture_loc);
gl->Disable (GL_DEPTH_TEST);
xrot += 0.3f;
yrot += 0.2f;
zrot += 0.4f;
}
示例8: gluLookAt
static void
_callback_opengl (gint width, gint height, guint texture, gpointer stuff)
{
GstGLFilterCube *cube_filter = GST_GL_FILTER_CUBE (stuff);
GstGLFilter *filter = GST_GL_FILTER (stuff);
GstGLFuncs *gl = filter->context->gl_vtable;
static GLfloat xrot = 0;
static GLfloat yrot = 0;
static GLfloat zrot = 0;
/* *INDENT-OFF* */
const GLfloat v_vertices[] = {
/*| Vertex | TexCoord |*/
/* front face */
1.0, 1.0, -1.0, 0.0, 0.0,
1.0, -1.0, -1.0, 1.0, 0.0,
-1.0, -1.0, -1.0, 1.0, 1.0,
-1.0, 1.0, -1.0, 0.0, 1.0,
/* back face */
-1.0, 1.0, 1.0, 0.0, 0.0,
-1.0, -1.0, 1.0, 1.0, 0.0,
1.0, -1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 0.0, 1.0,
/* right face */
-1.0, 1.0, -1.0, 0.0, 0.0,
-1.0, -1.0, -1.0, 1.0, 0.0,
-1.0, -1.0, 1.0, 1.0, 1.0,
-1.0, 1.0, 1.0, 0.0, 1.0,
/* left face */
1.0, 1.0, 1.0, 0.0, 0.0,
1.0, -1.0, 1.0, 1.0, 0.0,
1.0, -1.0, -1.0, 1.0, 1.0,
1.0, 1.0, -1.0, 0.0, 1.0,
/* top face */
1.0, 1.0, 1.0, 0.0, 0.0,
1.0, 1.0, -1.0, 1.0, 0.0,
-1.0, 1.0, -1.0, 1.0, 1.0,
-1.0, 1.0, 1.0, 0.0, 1.0,
/* bottom face */
1.0, -1.0, 1.0, 0.0, 0.0,
1.0, -1.0, -1.0, 1.0, 0.0,
-1.0, -1.0, -1.0, 1.0, 1.0,
-1.0, -1.0, 1.0, 0.0, 1.0,
};
/* *INDENT-ON* */
GLushort indices[] = {
0, 1, 2,
0, 2, 3,
4, 5, 6,
4, 6, 7,
8, 9, 10,
8, 10, 11,
12, 13, 14,
12, 14, 15,
16, 17, 18,
16, 18, 19,
20, 21, 22,
20, 22, 23
};
gl->Enable (GL_DEPTH_TEST);
gl->Enable (GL_TEXTURE_2D);
gl->BindTexture (GL_TEXTURE_2D, texture);
gl->ClearColor (cube_filter->red, cube_filter->green, cube_filter->blue, 0.0);
gl->Clear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
gl->MatrixMode (GL_PROJECTION);
gluLookAt (0.0, 0.0, -6.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
gl->MatrixMode (GL_MODELVIEW);
gl->LoadIdentity ();
// gl->Translatef (0.0f, 0.0f, -5.0f);
gl->Rotatef (xrot, 1.0f, 0.0f, 0.0f);
gl->Rotatef (yrot, 0.0f, 1.0f, 0.0f);
gl->Rotatef (zrot, 0.0f, 0.0f, 1.0f);
gl->ClientActiveTexture (GL_TEXTURE0);
gl->EnableClientState (GL_TEXTURE_COORD_ARRAY);
gl->EnableClientState (GL_VERTEX_ARRAY);
gl->VertexPointer (3, GL_FLOAT, 5 * sizeof (float), v_vertices);
gl->TexCoordPointer (2, GL_FLOAT, 5 * sizeof (float), &v_vertices[3]);
gl->DrawElements (GL_TRIANGLES, 36, GL_UNSIGNED_SHORT, indices);
gl->DisableClientState (GL_TEXTURE_COORD_ARRAY);
gl->DisableClientState (GL_VERTEX_ARRAY);
gl->Disable (GL_DEPTH_TEST);
xrot += 0.3f;
yrot += 0.2f;
zrot += 0.4f;
}
示例9:
void
gst_gl_effects_luma_to_curve (GstGLEffects * effects,
GstGLEffectsCurve curve,
gint curve_index, gint width, gint height, GLuint texture)
{
GstGLShader *shader;
GstGLFilter *filter = GST_GL_FILTER (effects);
GstGLContext *context = filter->context;
GstGLFuncs *gl = context->gl_vtable;
shader = g_hash_table_lookup (effects->shaderstable, "lumamap0");
if (!shader) {
shader = gst_gl_shader_new (context);
g_hash_table_insert (effects->shaderstable, "lumamap0", shader);
}
if (!gst_gl_shader_compile_and_check (shader,
luma_to_curve_fragment_source, GST_GL_SHADER_FRAGMENT_SOURCE)) {
gst_gl_context_set_error (context,
"Failed to initialize luma to curve shader");
GST_ELEMENT_ERROR (effects, RESOURCE, NOT_FOUND,
("%s", gst_gl_context_get_error ()), (NULL));
return;
}
gl->MatrixMode (GL_PROJECTION);
gl->LoadIdentity ();
gst_gl_shader_use (shader);
if (effects->curve[curve_index] == 0) {
/* this parameters are needed to have a right, predictable, mapping */
gl->GenTextures (1, &effects->curve[curve_index]);
gl->Enable (GL_TEXTURE_1D);
gl->BindTexture (GL_TEXTURE_1D, effects->curve[curve_index]);
gl->TexParameteri (GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
gl->TexParameteri (GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
gl->TexParameteri (GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP);
gl->TexParameteri (GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, GL_CLAMP);
gl->TexImage1D (GL_TEXTURE_1D, 0, curve.bytes_per_pixel,
curve.width, 0, GL_RGB, GL_UNSIGNED_BYTE, curve.pixel_data);
gl->Disable (GL_TEXTURE_1D);
}
gl->ActiveTexture (GL_TEXTURE2);
gl->Enable (GL_TEXTURE_2D);
gl->BindTexture (GL_TEXTURE_2D, texture);
gst_gl_shader_set_uniform_1i (shader, "tex", 2);
gl->Disable (GL_TEXTURE_2D);
gl->ActiveTexture (GL_TEXTURE1);
gl->Enable (GL_TEXTURE_1D);
gl->BindTexture (GL_TEXTURE_1D, effects->curve[curve_index]);
gst_gl_shader_set_uniform_1i (shader, "curve", 1);
gl->Disable (GL_TEXTURE_1D);
gst_gl_filter_draw_texture (filter, texture, width, height);
}
开发者ID:freedesktop-unofficial-mirror,项目名称:gstreamer__attic__gst-plugins-gl,代码行数:65,代码来源:gstgleffectlumatocurve.c
示例10: gluLookAt
//.........这里部分代码省略.........
GLushort indices[] = {
0, 1, 2,
0, 2, 3,
4, 5, 6,
4, 6, 7,
8, 9, 10,
8, 10, 11,
12, 13, 14,
12, 14, 15,
16, 17, 18,
16, 18, 19,
20, 21, 22,
20, 22, 23
};
/* *INDENT-ON* */
gl = GST_GL_FILTER (bumper)->context->gl_vtable;
//eye point
gl->MatrixMode (GL_PROJECTION);
gluLookAt (0.0, 0.0, -6.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
gl->MatrixMode (GL_MODELVIEW);
//scene conf
gl->Enable (GL_DEPTH_TEST);
gl->DepthFunc (GL_LEQUAL);
gl->Hint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
gl->ShadeModel (GL_SMOOTH);
//set the lights
gl->Lightfv (GL_LIGHT0, GL_POSITION, light_direction0);
gl->Lightfv (GL_LIGHT0, GL_DIFFUSE, light_diffuse0);
gl->Lightfv (GL_LIGHT1, GL_POSITION, light_direction1);
gl->Lightfv (GL_LIGHT1, GL_DIFFUSE, light_diffuse1);
gl->Materialfv (GL_FRONT, GL_DIFFUSE, mat_diffuse);
gl->ColorMaterial (GL_FRONT_AND_BACK, GL_DIFFUSE);
gl->Enable (GL_COLOR_MATERIAL);
gl->Enable (GL_LIGHTING);
gl->Enable (GL_LIGHT0);
gl->Enable (GL_LIGHT1);
//configure shader
gst_gl_shader_use (bumper->shader);
locTangent =
gst_gl_shader_get_attribute_location (bumper->shader, "aTangent");
//set the normal map
gl->ActiveTexture (GL_TEXTURE1);
gst_gl_shader_set_uniform_1i (bumper->shader, "texture1", 1);
gl->BindTexture (GL_TEXTURE_2D, bumper->bumpmap);
//set the video texture
gl->ActiveTexture (GL_TEXTURE0);
gst_gl_shader_set_uniform_1i (bumper->shader, "texture0", 0);
gl->BindTexture (GL_TEXTURE_2D, texture);
gl->Rotatef (xrot, 1.0f, 0.0f, 0.0f);
gl->Rotatef (yrot, 0.0f, 1.0f, 0.0f);
gl->Rotatef (zrot, 0.0f, 0.0f, 1.0f);
gl->EnableVertexAttribArray (locTangent);
gl->ClientActiveTexture (GL_TEXTURE0);
gl->EnableClientState (GL_TEXTURE_COORD_ARRAY);
gl->EnableClientState (GL_VERTEX_ARRAY);
gl->EnableClientState (GL_NORMAL_ARRAY);
gl->VertexAttribPointer (locTangent, 3, GL_FLOAT, 0, sizeof (MeshData),
&mesh[0].va0);
gl->VertexPointer (3, GL_FLOAT, sizeof (MeshData), &mesh[0].x);
gl->NormalPointer (GL_FLOAT, sizeof (MeshData), &mesh[0].nx);
gl->TexCoordPointer (2, GL_FLOAT, sizeof (MeshData), &mesh[0].s0);
gl->ClientActiveTexture (GL_TEXTURE1);
gl->EnableClientState (GL_TEXTURE_COORD_ARRAY);
gl->TexCoordPointer (2, GL_FLOAT, sizeof (MeshData), &mesh[0].s1);
gl->DrawElements (GL_TRIANGLES, 36, GL_UNSIGNED_SHORT, indices);
gl->DisableClientState (GL_VERTEX_ARRAY);
gl->DisableClientState (GL_TEXTURE_COORD_ARRAY);
gl->DisableClientState (GL_NORMAL_ARRAY);
gl->ClientActiveTexture (GL_TEXTURE0);
gl->DisableClientState (GL_TEXTURE_COORD_ARRAY);
gl->DisableVertexAttribArray (locTangent);
gst_gl_context_clear_shader (context);
gl->Disable (GL_LIGHT0);
gl->Disable (GL_LIGHT1);
gl->Disable (GL_LIGHTING);
gl->Disable (GL_COLOR_MATERIAL);
xrot += 1.0f;
yrot += 0.9f;
zrot += 0.6f;
}
示例11: sizeof
static gboolean
_callback (gpointer stuff)
{
GstGLFilter *filter = GST_GL_FILTER (stuff);
GstGLFilterCube *cube_filter = GST_GL_FILTER_CUBE (filter);
GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable;
static GLfloat xrot = 0;
static GLfloat yrot = 0;
static GLfloat zrot = 0;
const GLfloat matrix[] = {
0.5f, 0.0f, 0.0f, 0.0f,
0.0f, 0.5f, 0.0f, 0.0f,
0.0f, 0.0f, 0.5f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
};
gl->Enable (GL_DEPTH_TEST);
gl->ClearColor (cube_filter->red, cube_filter->green, cube_filter->blue, 0.0);
gl->Clear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
gst_gl_shader_use (cube_filter->shader);
gl->ActiveTexture (GL_TEXTURE0);
gl->BindTexture (GL_TEXTURE_2D, cube_filter->in_tex->tex_id);
gst_gl_shader_set_uniform_1i (cube_filter->shader, "s_texture", 0);
gst_gl_shader_set_uniform_1f (cube_filter->shader, "xrot_degree", xrot);
gst_gl_shader_set_uniform_1f (cube_filter->shader, "yrot_degree", yrot);
gst_gl_shader_set_uniform_1f (cube_filter->shader, "zrot_degree", zrot);
gst_gl_shader_set_uniform_matrix_4fv (cube_filter->shader, "u_matrix", 1,
GL_FALSE, matrix);
if (!cube_filter->vertex_buffer) {
if (gl->GenVertexArrays) {
gl->GenVertexArrays (1, &cube_filter->vao);
gl->BindVertexArray (cube_filter->vao);
}
gl->GenBuffers (1, &cube_filter->vertex_buffer);
gl->BindBuffer (GL_ARRAY_BUFFER, cube_filter->vertex_buffer);
gl->BufferData (GL_ARRAY_BUFFER, 6 * 4 * 5 * sizeof (GLfloat), vertices,
GL_STATIC_DRAW);
gl->GenBuffers (1, &cube_filter->vbo_indices);
gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, cube_filter->vbo_indices);
gl->BufferData (GL_ELEMENT_ARRAY_BUFFER, sizeof (indices), indices,
GL_STATIC_DRAW);
if (gl->GenVertexArrays) {
_bind_buffer (cube_filter);
gl->BindVertexArray (0);
}
gl->BindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);
gl->BindBuffer (GL_ARRAY_BUFFER, 0);
}
if (gl->GenVertexArrays)
gl->BindVertexArray (cube_filter->vao);
_bind_buffer (cube_filter);
gl->DrawElements (GL_TRIANGLES, 36, GL_UNSIGNED_SHORT, 0);
if (gl->GenVertexArrays)
gl->BindVertexArray (0);
_unbind_buffer (cube_filter);
gl->Disable (GL_DEPTH_TEST);
xrot += 0.3f;
yrot += 0.2f;
zrot += 0.4f;
return TRUE;
}
示例12:
void
gst_gl_test_src_shader (GstGLTestSrc * v, GstBuffer * buffer, int w, int h)
{
GstGLFuncs *gl = v->context->gl_vtable;
/* *INDENT-OFF* */
const GLfloat positions[] = {
-1.0, 1.0, 0.0, 1.0,
1.0, 1.0, 0.0, 1.0,
1.0, -1.0, 0.0, 1.0,
-1.0, -1.0, 0.0, 1.0,
};
const GLfloat identitiy_matrix[] = {
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0,
};
const GLfloat uvs[] = {
0.0, 1.0,
1.0, 1.0,
1.0, 0.0,
0.0, 0.0,
};
/* *INDENT-ON* */
GLushort indices[] = { 0, 1, 2, 3, 0 };
GLint attr_position_loc = 0;
GLint attr_uv_loc = 0;
if (gst_gl_context_get_gl_api (v->context)) {
gst_gl_context_clear_shader (v->context);
gl->BindTexture (GL_TEXTURE_2D, 0);
gl->Disable (GL_TEXTURE_2D);
gst_gl_shader_use (v->shader);
attr_position_loc =
gst_gl_shader_get_attribute_location (v->shader, "position");
attr_uv_loc = gst_gl_shader_get_attribute_location (v->shader, "uv");
/* Load the vertex position */
gl->VertexAttribPointer (attr_position_loc, 4, GL_FLOAT,
GL_FALSE, 0, positions);
/* Load the texture coordinate */
gl->VertexAttribPointer (attr_uv_loc, 2, GL_FLOAT, GL_FALSE, 0, uvs);
gl->EnableVertexAttribArray (attr_position_loc);
gl->EnableVertexAttribArray (attr_uv_loc);
gst_gl_shader_set_uniform_matrix_4fv (v->shader, "mvp",
1, GL_FALSE, identitiy_matrix);
gst_gl_shader_set_uniform_1f (v->shader, "time",
(gfloat) v->running_time / GST_SECOND);
gst_gl_shader_set_uniform_1f (v->shader, "aspect_ratio",
(gfloat) w / (gfloat) h);
gl->DrawElements (GL_TRIANGLE_STRIP, 5, GL_UNSIGNED_SHORT, indices);
gl->DisableVertexAttribArray (attr_position_loc);
gl->DisableVertexAttribArray (attr_uv_loc);
gst_gl_context_clear_shader (v->context);
}
}