本文整理汇总了C++中Framebuffer::activate方法的典型用法代码示例。如果您正苦于以下问题:C++ Framebuffer::activate方法的具体用法?C++ Framebuffer::activate怎么用?C++ Framebuffer::activate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Framebuffer
的用法示例。
在下文中一共展示了Framebuffer::activate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set
bool set()
{
if(!color || !depth)
return false;
if(!fakeTargetActive || !SHARE_BUFFERS)
{
fakeTargetActive = true;
// FIXME?
fbo->activate();
if(!fbo->validate())
{
fbo->disable();
return false;
}
/* not required because opengl can't clear just part of buffer
// unless using scissor
// which is a horrible hack
D3DRECT rc = { 0 };
rc.x2 = BUFFER_WIDTH * 2;
rc.y2 = BUFFER_HEIGHT * 2;
*/
// because on opengl scissor test affects clear
// but on direct3d not
glDisable(GL_SCISSOR_TEST);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glDepthMask(GL_TRUE);
// Black, no alpha test
//hr = device.Clear(1, &rc, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL, 0xFF000000, 1.0f, 0);
// Black, alpha test
//hr = device.Clear(1, &rc, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL, 0, 1.0f, 0);
// White, no alpha test
//hr = device.Clear(1, &rc, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL, 0xFFFFFFFF, 1.0f, 0);
// White, alpha tested (Normal)
glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
glClearDepth(1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
}
glViewport(pos.x * BUFFER_WIDTH, pos.y * BUFFER_HEIGHT, BUFFER_WIDTH, BUFFER_HEIGHT);
return true;
}