本文整理汇总了C++中GstGLFuncs::FramebufferRenderbuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ GstGLFuncs::FramebufferRenderbuffer方法的具体用法?C++ GstGLFuncs::FramebufferRenderbuffer怎么用?C++ GstGLFuncs::FramebufferRenderbuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GstGLFuncs
的用法示例。
在下文中一共展示了GstGLFuncs::FramebufferRenderbuffer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
static gboolean
_2d_texture_renderer_init_fbo (GstAmc2DTextureRenderer * renderer)
{
GstGLFuncs *gl;
GLuint fake_texture = 0;
guint out_width, out_height;
out_width = GST_VIDEO_INFO_WIDTH (&renderer->info);
out_height = GST_VIDEO_INFO_HEIGHT (&renderer->info);
gl = renderer->context->gl_vtable;
if (!gl->GenFramebuffers) {
/* turn off the pipeline because Frame buffer object is a not present */
gst_gl_context_set_error (renderer->context,
"Context, EXT_framebuffer_object supported: no");
return FALSE;
}
GST_INFO ("Context, EXT_framebuffer_object supported: yes");
/* setup FBO */
gl->GenFramebuffers (1, &renderer->fbo);
gl->BindFramebuffer (GL_FRAMEBUFFER, renderer->fbo);
/* setup the render buffer for depth */
gl->GenRenderbuffers (1, &renderer->depth_buffer);
gl->BindRenderbuffer (GL_RENDERBUFFER, renderer->depth_buffer);
gl->RenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT16,
out_width, out_height);
/* a fake texture is attached to the render FBO (cannot init without it) */
gl->GenTextures (1, &fake_texture);
gl->BindTexture (GL_TEXTURE_2D, fake_texture);
gl->TexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, out_width, out_height,
0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
gl->TexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
/* attach the texture to the FBO to renderer to */
gl->FramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D, fake_texture, 0);
/* attach the depth render buffer to the FBO */
gl->FramebufferRenderbuffer (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
GL_RENDERBUFFER, renderer->depth_buffer);
if (!gst_gl_context_check_framebuffer_status (renderer->context)) {
gst_gl_context_set_error (renderer->context,
"GL framebuffer status incomplete");
return FALSE;
}
/* unbind the FBO */
gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
gl->DeleteTextures (1, &fake_texture);
return TRUE;
}