本文整理汇总了C++中Texture::GetMutexHandle方法的典型用法代码示例。如果您正苦于以下问题:C++ Texture::GetMutexHandle方法的具体用法?C++ Texture::GetMutexHandle怎么用?C++ Texture::GetMutexHandle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Texture
的用法示例。
在下文中一共展示了Texture::GetMutexHandle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Capture
/*---------------------------------------------------------------------------
Captures the contents of the frame buffer object for streaming purposes.
Returns true if the frame was successfully captured. If the Wait flag is
set, the function with use a blocking mutex lock on the Frame texture.
---------------------------------------------------------------------------*/
bool Filter::Capture(Texture &Frame, bool Wait)
{
if (!Ready()) {return false;}
MutexControl Mutex(Frame.GetMutexHandle());
if (!Wait && !Mutex.LockRequest()) {return false;}
else {Mutex.Lock();}
vector2u Res = Frame.Resolution();
if (Res.U != ViewPort.C2 || Res.V != ViewPort.C3 || Frame.DataType() != Texture::TypeRGB)
{
Res.Set(ViewPort.C2, ViewPort.C3);
Frame.Create(Res, Texture::TypeRGB);
}
glBindFramebuffer(GL_READ_FRAMEBUFFER, FBOID);
glReadPixels(0, 0, Res.U, Res.V, Frame.DataFormat(), Frame.DataCompType(), Frame.Pointer());
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
#if defined (DEBUG)
GLenum Error = glGetError();
if (Error != GL_NO_ERROR) {throw dexception("OpenGL generated an error: %s", Debug::ErrorGL(Error));}
#endif
return true;
}